Skip to content

Commit 9fb37ce

Browse files
Octopus intelligent slots - avoid crash if empty
Better fix this time
1 parent 72eeca0 commit 9fb37ce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

predbat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,9 @@ def update_pred(self):
826826

827827
# Octopus intelligent slots
828828
if 'octopus_intelligent_slot' in self.args:
829-
self.octopus_slots = self.get_state(entity_id = self.args['octopus_intelligent_slot'], attribute='completedDispatches')
829+
completed = self.get_state(entity_id = self.args['octopus_intelligent_slot'], attribute='completedDispatches')
830+
if completed:
831+
self.octopus_slots += planned
830832
planned = self.get_state(entity_id = self.args['octopus_intelligent_slot'], attribute='plannedDispatches')
831833
if planned:
832834
self.octopus_slots += planned

0 commit comments

Comments
 (0)