mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
Exemption handling
Handles some unexpected state behavior
This commit is contained in:
parent
abc151601b
commit
ca4b4fc7bd
1 changed files with 18 additions and 9 deletions
|
|
@ -328,16 +328,25 @@ class CircadianSwitch(SwitchDevice, RestoreEntity):
|
|||
_LOGGER.debug(light + " Brightness Adjusted - brightness: " + str(brightness) + ", transition: " + str(transition))
|
||||
|
||||
def light_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 == 'on' and from_state.state != 'on':
|
||||
self.adjust_lights([entity_id], DEFAULT_INITIAL_TRANSITION)
|
||||
try:
|
||||
_LOGGER.debug(entity_id + " change from " + str(from_state) + " to " + str(to_state))
|
||||
if to_state.state == 'on' and from_state.state != 'on':
|
||||
self.adjust_lights([entity_id], DEFAULT_INITIAL_TRANSITION)
|
||||
except:
|
||||
pass
|
||||
|
||||
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)
|
||||
try:
|
||||
_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)
|
||||
except:
|
||||
pass
|
||||
|
||||
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)
|
||||
try:
|
||||
_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)
|
||||
except:
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue