Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Dec 2, 2023
1 parent 251cd9e commit 73193c4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8042,13 +8042,9 @@ def execute_plan(self):
minutes_start = inverter.charge_start_time_minutes

# Avoid having too long a period to configure as registers only support 24-hours
if (minutes_start < self.minutes_now) and ((minutes_end - minutes_start) >= 24*60):
if (minutes_start < self.minutes_now) and ((minutes_end - minutes_start) >= 24 * 60):
minutes_start = int(self.minutes_now / 30) * 30
self.log(
"Move on charge window start time to avoid wrap - new start {}".format(
self.time_abs_str(minutes_start)
)
)
self.log("Move on charge window start time to avoid wrap - new start {}".format(self.time_abs_str(minutes_start)))

# Check if end is within 24 hours of now and end is in the future
if (minutes_end - self.minutes_now) < 24 * 60 and minutes_end > self.minutes_now:
Expand Down Expand Up @@ -8137,13 +8133,9 @@ def execute_plan(self):
minutes_start = inverter.discharge_start_time_minutes

# Avoid having too long a period to configure as registers only support 24-hours
if (minutes_start < self.minutes_now) and ((minutes_end - minutes_start) >= 24*60):
if (minutes_start < self.minutes_now) and ((minutes_end - minutes_start) >= 24 * 60):
minutes_start = int(self.minutes_now / 30) * 30
self.log(
"Move on discharge window start time to avoid wrap - new start {}".format(
self.time_abs_str(minutes_start)
)
)
self.log("Move on discharge window start time to avoid wrap - new start {}".format(self.time_abs_str(minutes_start)))

discharge_start_time = self.midnight_utc + timedelta(minutes=minutes_start)
discharge_end_time = self.midnight_utc + timedelta(minutes=(minutes_end + 1)) # Add in 1 minute margin to allow Predbat to restore ECO mode
Expand Down Expand Up @@ -9542,4 +9534,4 @@ def run_time_loop_balance(self, cb_args):
except Exception as e:
self.log("ERROR: Exception raised {}".format(e))
self.record_status("ERROR: Exception raised {}".format(e))
raise e
raise e

0 comments on commit 73193c4

Please sign in to comment.