mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
Adjust lights immediately when disable entity state changes
I'm thinking about removing the disable entity option, but while it remains this is the proper behavior
This commit is contained in:
parent
be01be243d
commit
abc151601b
1 changed files with 7 additions and 0 deletions
|
|
@ -148,6 +148,8 @@ class CircadianSwitch(SwitchDevice, RestoreEntity):
|
|||
track_state_change(hass, self._lights, self.light_state_changed)
|
||||
if self._sleep_entity is not None:
|
||||
track_state_change(hass, self._sleep_entity, self.sleep_state_changed)
|
||||
if self._disable_entity is not None:
|
||||
track_state_change(hass, self._disable_entity, self.disable_state_changed)
|
||||
|
||||
@property
|
||||
def entity_id(self):
|
||||
|
|
@ -333,4 +335,9 @@ class CircadianSwitch(SwitchDevice, RestoreEntity):
|
|||
def sleep_state_changed(self, entity_id, from_state, to_state):
|
||||
_LOGGER.debug(entity_id + " change from " + str(from_state) + " to " + str(to_state))
|
||||
if to_state.state == self._sleep_state or from_state.state == self._sleep_state:
|
||||
self.update_switch(DEFAULT_INITIAL_TRANSITION)
|
||||
|
||||
def disable_state_changed(self, entity_id, from_state, to_state):
|
||||
_LOGGER.debug(entity_id + " change from " + str(from_state) + " to " + str(to_state))
|
||||
if from_state.state == self._disable_state:
|
||||
self.update_switch(DEFAULT_INITIAL_TRANSITION)
|
||||
Loading…
Add table
Add a link
Reference in a new issue