Skip to content

Commit

Permalink
fix: Added some additional checks around cost tracker attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed May 27, 2024
1 parent 6a49f60 commit 79d339c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/octopus_energy/cost_tracker/cost_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ async def _async_calculate_cost(self, event: Event[EventStateChangedData]):
old_last_reset = parse_datetime(old_state.attributes["last_reset"])

consumption_data = add_consumption(current,
self._attributes["tracked_charges"],
self._attributes["untracked_charges"],
self._attributes["tracked_charges"] if "tracked_charges" in self._attributes else [],
self._attributes["untracked_charges"] if "untracked_charges" in self._attributes else [],
float(new_state.state),
None if old_state.state is None or old_state.state in (STATE_UNAVAILABLE, STATE_UNKNOWN) else float(old_state.state),
new_last_reset,
Expand Down

0 comments on commit 79d339c

Please sign in to comment.