Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/predbat/octopus.py
Original file line number Diff line number Diff line change
Expand Up @@ -2375,7 +2375,7 @@ def load_octopus_slots(self, car_n, octopus_slots, octopus_intelligent_consider_
new_slot["end"] = end_minutes
new_slot["kwh"] = kwh
new_slot["average"] = self.rate_import.get(start_minutes, self.rate_min)
if octopus_slot_low_rate and source != "bump-charge":
if octopus_slot_low_rate and source != "bump-charge" and source != "BOOST":
new_slot["average"] = self.rate_min # Assume price in min
Comment on lines +2378 to 2379
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces a new special-case dispatch source ("BOOST") affecting both slot pricing display (load_octopus_slots) and rate masking (rate_add_io_slots), but there’s no unit test coverage ensuring BOOST is treated the same way as bump-charge. Please add/update tests (e.g., in apps/predbat/tests/test_octopus_slots.py and/or test_rate_add_io_slots.py) to assert BOOST slots don’t get forced to rate_min and don’t mark minutes as off-peak.

Copilot generated this review using guidance from repository custom instructions.
new_slot["cost"] = dp2(new_slot["average"] * kwh)
Comment on lines 2377 to 2380
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string literal checks for special IO dispatch sources are duplicated across multiple branches (e.g., comparing against "bump-charge" and "BOOST" inline). Consider centralizing this into a single helper/constant (e.g., a set of “non-low-rate” sources) to avoid future drift where one call site gets updated but others don’t.

Copilot uses AI. Check for mistakes.
new_slot["soc"] = dp2(car_soc)
Expand All @@ -2387,7 +2387,7 @@ def load_octopus_slots(self, car_n, octopus_slots, octopus_intelligent_consider_
new_slot["end"] = end_minutes_original
new_slot["kwh"] = 0.0
new_slot["average"] = self.rate_import.get(start_minutes, self.rate_min)
if octopus_slot_low_rate and source != "bump-charge":
if octopus_slot_low_rate and source != "bump-charge" and source != "BOOST":
new_slot["average"] = self.rate_min # Assume price in min
new_slot["cost"] = 0.0
new_slot["soc"] = dp2(car_soc)
Expand All @@ -2400,7 +2400,7 @@ def load_octopus_slots(self, car_n, octopus_slots, octopus_intelligent_consider_
new_slot["end"] = end_minutes
new_slot["kwh"] = kwh
new_slot["average"] = self.rate_import.get(start_minutes, self.rate_min)
if octopus_slot_low_rate and source != "bump-charge":
if octopus_slot_low_rate and source != "bump-charge" and source != "BOOST":
new_slot["average"] = self.rate_min # Assume price in min
new_slot["cost"] = dp2(new_slot["average"] * kwh)
new_slot["soc"] = dp2(car_soc)
Expand Down Expand Up @@ -2429,7 +2429,7 @@ def rate_add_io_slots(self, car_n, rates, octopus_slots):
start_minutes, end_minutes, kwh, source, location = self.decode_octopus_slot(car_n, slot, raw=True)

# Ignore bump-charge slots as their cost won't change
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline comment says “Ignore bump-charge slots as their cost won't change” but this condition now also ignores "BOOST". Update the comment to reflect the actual behavior so it stays accurate for future readers.

Suggested change
# Ignore bump-charge slots as their cost won't change
# Ignore bump-charge and BOOST slots as their cost/handling is fixed and won't change

Copilot uses AI. Check for mistakes.
if source != "bump-charge" and (not location or location == "AT_HOME"):
if source != "bump-charge" and source != "BOOST" and (not location or location == "AT_HOME"):
# Round slots to 30 minute boundary
# Floor the start (round down) and ceiling the end (round up)
# This ensures any partial overlap with a 30-min slot marks the entire slot as off-peak
Expand Down
Loading