mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
Move include_config_in_attributes
This commit is contained in:
parent
26c19525cd
commit
ec558e5616
1 changed files with 10 additions and 10 deletions
|
|
@ -771,16 +771,6 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
# Set in self._update_attrs_and_maybe_adapt_lights
|
||||
self._settings: dict[str, Any] = {}
|
||||
|
||||
self._config: dict[str, Any] = {}
|
||||
if self._include_config_in_attributes:
|
||||
attrdata = deepcopy(data)
|
||||
for k, v in attrdata.items():
|
||||
if isinstance(v, (datetime.date, datetime.datetime)):
|
||||
attrdata[k] = v.isoformat()
|
||||
if isinstance(v, (datetime.timedelta)):
|
||||
attrdata[k] = v.total_seconds()
|
||||
self._config.update(attrdata)
|
||||
|
||||
# Set and unset tracker in async_turn_on and async_turn_off
|
||||
self.remove_listeners = []
|
||||
_LOGGER.debug(
|
||||
|
|
@ -811,6 +801,16 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
|
||||
self._detect_non_ha_changes = data[CONF_DETECT_NON_HA_CHANGES]
|
||||
self._include_config_in_attributes = data[CONF_INCLUDE_CONFIG_IN_ATTRIBUTES]
|
||||
self._config: dict[str, Any] = {}
|
||||
if self._include_config_in_attributes:
|
||||
attrdata = deepcopy(data)
|
||||
for k, v in attrdata.items():
|
||||
if isinstance(v, (datetime.date, datetime.datetime)):
|
||||
attrdata[k] = v.isoformat()
|
||||
if isinstance(v, (datetime.timedelta)):
|
||||
attrdata[k] = v.total_seconds()
|
||||
self._config.update(attrdata)
|
||||
|
||||
self._initial_transition = data[CONF_INITIAL_TRANSITION]
|
||||
self._sleep_transition = data[CONF_SLEEP_TRANSITION]
|
||||
self._only_once = data[CONF_ONLY_ONCE]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue