Skip to content

Commit

Permalink
chore: Removed old config attributes from target rate sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed Nov 14, 2023
1 parent 82e4564 commit f6f5e51
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/octopus_energy/target_rates/target_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
from ..const import (
CONFIG_TARGET_NAME,
CONFIG_TARGET_HOURS,
CONFIG_TARGET_OLD_END_TIME,
CONFIG_TARGET_OLD_HOURS,
CONFIG_TARGET_OLD_MPAN,
CONFIG_TARGET_OLD_NAME,
CONFIG_TARGET_OLD_START_TIME,
CONFIG_TARGET_OLD_TYPE,
CONFIG_TARGET_TYPE,
CONFIG_TARGET_START_TIME,
CONFIG_TARGET_END_TIME,
Expand Down Expand Up @@ -214,6 +220,9 @@ async def async_added_to_hass(self):
self._state = state.state
self._attributes = {}
for x in state.attributes.keys():
if x in [CONFIG_TARGET_OLD_NAME, CONFIG_TARGET_OLD_HOURS, CONFIG_TARGET_OLD_TYPE, CONFIG_TARGET_OLD_START_TIME, CONFIG_TARGET_OLD_END_TIME, CONFIG_TARGET_OLD_MPAN]:
continue

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

# Make sure our attributes don't override any changed settings
Expand Down

0 comments on commit f6f5e51

Please sign in to comment.