Thresholds based on battery
For a detached installation with a battery, use the battery level or the discharge time of the battery.
The idea is to switch off stuff at dusk, when the battery starts discharging, and/or keep appliances switching on/off during night as the battery discharges, but handling the discharge rate.
There is a need to think about the UI: how to switch from grid surplus thresholds to battery thresholds