Skip to content

Commit

Permalink
chore: Fixed issue with old attribute fields coming through
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed Nov 17, 2023
1 parent 53964ae commit 0cf90d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ async def async_added_to_hass(self):

if state is not None and self._state is None:
self._state = state.state
self._attributes = dict_to_typed_dict(state.attributes)
self._attributes = {}
temp_attributes = dict_to_typed_dict(state.attributes)
for x in temp_attributes.keys():
if x in ['valid_from', 'valid_to']:
continue

self._attributes[x] = state.attributes[x]

_LOGGER.debug(f'Restored OctopusEnergyElectricityCurrentStandingCharge state: {self._state}')
8 changes: 7 additions & 1 deletion custom_components/octopus_energy/gas/standing_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ async def async_added_to_hass(self):

if state is not None and self._state is None:
self._state = state.state
self._attributes = dict_to_typed_dict(state.attributes)
self._attributes = {}
temp_attributes = dict_to_typed_dict(state.attributes)
for x in temp_attributes.keys():
if x in ['valid_from', 'valid_to']:
continue

self._attributes[x] = state.attributes[x]

_LOGGER.debug(f'Restored OctopusEnergyGasCurrentStandingCharge state: {self._state}')

0 comments on commit 0cf90d3

Please sign in to comment.