Skip to content

Commit f47b0c1

Browse files
Moving setting the discharge current to before the button press.
1 parent 4283473 commit f47b0c1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/predbat/inverter.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,16 +2384,18 @@ def adjust_force_export(self, force_export, new_start_time=None, new_end_time=No
23842384
self.write_and_poll_switch("scheduled_discharge_enable", self.base.get_arg("scheduled_discharge_enable", indirect=False, index=self.id), True)
23852385
self.log("Inverter {} Turning on scheduled export".format(self.id))
23862386

2387+
# Set discharge current before the button press so the inverter registers it when the schedule is committed
2388+
if force_export and (not self.inv_has_charge_enable_time or self.inv_clear_slot_on_disable) and (self.inv_output_charge_control == "current"):
2389+
if self.inv_charge_control_immediate:
2390+
self.enable_charge_discharge_with_time_current("discharge", True)
2391+
23872392
if (new_end != old_end) or (new_start != old_start) or (force_export != old_discharge_enable):
23882393
if self.inv_time_button_press:
23892394
self.press_and_poll_button()
23902395

23912396
# Force export, turn it on after we change the window
23922397
if force_export:
23932398
self.adjust_inverter_mode(force_export, changed_start_end=changed_start_end)
2394-
if (not self.inv_has_charge_enable_time or self.inv_clear_slot_on_disable) and (self.inv_output_charge_control == "current"):
2395-
if self.inv_charge_control_immediate:
2396-
self.enable_charge_discharge_with_time_current("discharge", True)
23972399

23982400
# Notify
23992401
if changed_start_end:

0 commit comments

Comments
 (0)