Skip to content

Commit 4f792c3

Browse files
authored
Restore to Self Consumption after pre-period export, not TOU (#26)
When a pre-period headroom export ends (time elapsed or SOC floor hit), the previous mode was TOU — which would immediately recharge the battery from the grid during cheap-rate hours, undoing the headroom just created and causing an export/recharge oscillation cycle. TOU is a night-only charging mode and should never be the restore target after any timed export. Extend the existing out-of-cheap-rate TOU guard to cover the in-cheap-rate case too: whenever the saved restore mode is TOU, switch the restore target to SELF_POWERED instead. This preserves headroom from the time the export ends until cheap-rate stops at 08:00, at which point normal daytime logic resumes.
1 parent f57f2e1 commit 4f792c3

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

‎logic/timed_export.py‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,19 @@ async def start_timed_grid_export(
301301
current_mode_raw,
302302
)
303303
return False
304-
# TOU is a night-only mode. If the inverter is in TOU outside the cheap-rate
305-
# window (e.g. left over from an overnight Sigen schedule), restoring to it
306-
# after a daytime export would leave it in the wrong mode all day.
307-
if restore_mode == SIGEN_MODES["TOU"] and not is_cheap_rate_window(now_utc):
304+
# TOU is a night-only charging mode and should never be the restore
305+
# target after a timed export:
306+
# - During cheap-rate: restoring to TOU would let the inverter
307+
# recharge from the grid, immediately undoing any headroom just
308+
# created by the export.
309+
# - After cheap-rate: TOU left over from an overnight schedule
310+
# would leave the inverter in the wrong mode for the rest of
311+
# the day.
312+
# In both cases, restore to SELF_POWERED instead.
313+
if restore_mode == SIGEN_MODES["TOU"]:
308314
logger.info(
309-
"[TIMED EXPORT] Current mode is TOU outside cheap-rate window — "
310-
"will restore to SELF_POWERED instead."
315+
"[TIMED EXPORT] Current mode is TOU — "
316+
"will restore to SELF_POWERED instead to preserve headroom."
311317
)
312318
restore_mode = SIGEN_MODES["SELF_POWERED"]
313319
restore_label = str(mode_names.get(restore_mode, restore_mode))

0 commit comments

Comments
 (0)