Force Charge and Discharge - nathanmarlor/foxess_modbus GitHub Wiki
The inverters support a number of different ways to charge the battery from the grid, and discharge the battery to the grid.
Force Charge / Force Discharge Work Modes
The inverter allows integrations to programmatically control the input and output of the inverter over Modbus. This integration takes advantage of this by providing "Force Charge" and "Force Discharge" options under the "Work Mode" selector, which lets automations easily enable force charging and discharging.
There are two configurable parameters, "Force Charge Power" and "Force Discharge Power". These control the maximum charge/discharge power when using Force Charge and Force Discharge respectively. Note that this is the power through the inverter's AC interface, not the battery power nor the power drawn from / supplied to the grid.
The inverter will respect your configured Max Charge/Discharge current settings. Min Soc (On Grid) and Max SoC are also respected (except on the H1 over LAN).
However, this mode comes with some limitations, see Supported Features. Additionally, the inverter needs to be actively controlled by Home Assistant: if Home Assistant stops, the inverter will drop back into Feed-in First (from Force Discharge) or Back-up (from Force Charge).
Charge Periods
Charge periods can only be controlled on the H1 over RS485.
A charge period is a configurable period of time each day when the inverter can either 1) prevent the battery from discharging to the grid, or 2) charge the battery from the grid.
Charge periods are stored on the inverter, and can be edited on the front panel. They can also be set from the FoxCloud website or app. This integration exposes various entities related to charge periods (starting "Period 1 - " or "Period 2 - "), two services to set charge periods, and a lovelace card so set them.
Charge periods respect your configured Max Charge Current and Max SoC. They do not let you discharge the batteries to the grid.
If you're setting charge periods from an automation, the easiest thing to do it set one period for "00:00 - 23:59", and just enable/disable it as appropriate.
Mode Scheduler
FoxESS released a Mode Scheduler for the H1 in Manager Version 1.70. This is more powerful than Charge Periods, in that it lets you set up to 6 periods per day (rather than 2), and these periods can change the Work Mode, as well as having the option to Force Charge and Force Discharge.
However, currently the Mode Scheduler can only be used from the FoxCloud website, and version 2 for the FoxCloud app. It is not possible to read or write the Mode Scheduler over Modbus.
One limitation is that if you Force Charge during the day, your PV will probably drop to zero.