Skip to content

Commit

Permalink
Compare start/end times in hh:mm also (#1939)
Browse files Browse the repository at this point in the history
* Compare start/end times in hh:mm also

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
springfall2008 and pre-commit-ci-lite[bot] authored Jan 29, 2025
1 parent e007a94 commit c46f100
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/predbat/inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,10 @@ def adjust_force_export(self, force_export, new_start_time=None, new_end_time=No
elif "discharge_start_time" in self.base.args:
old_start = self.base.get_arg("discharge_start_time", index=self.id)
old_end = self.base.get_arg("discharge_end_time", index=self.id)
if len(old_start) == 5:
old_start += ":00"
if len(old_end) == 5:
old_end += ":00"
old_discharge_enable = self.base.get_arg("scheduled_discharge_enable", "off", index=self.id) == "on"
else:
self.log("Warn: Inverter {} unable read discharge window as neither REST, discharge_start_time or discharge_start_hour are set".format(self.id))
Expand Down Expand Up @@ -2181,6 +2185,10 @@ def adjust_charge_window(self, charge_start_time, charge_end_time, minutes_now):
elif "charge_start_time" in self.base.args:
old_start = self.base.get_arg("charge_start_time", index=self.id)
old_end = self.base.get_arg("charge_end_time", index=self.id)
if len(old_start) == 5:
old_start += ":00"
if len(old_end) == 5:
old_end += ":00"
old_charge_schedule_enable = self.base.get_arg("scheduled_charge_enable", "on", index=self.id)
else:
self.log("Warn: Inverter {} unable read charge window as neither REST or discharge_start_time".format(self.id))
Expand Down

0 comments on commit c46f100

Please sign in to comment.