Fix getting initial transition from config

This commit is contained in:
Clayton Nummer 2020-02-21 22:05:08 -05:00 committed by GitHub
commit 61741f6501
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -200,7 +200,7 @@ class CircadianSwitch(SwitchDevice, RestoreEntity):
self._state = True
# Make initial update
self.update_switch(CONF_INITIAL_TRANSITION)
self.update_switch(self._initial_transition)
self.schedule_update_ha_state()
@ -336,7 +336,7 @@ class CircadianSwitch(SwitchDevice, RestoreEntity):
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], CONF_INITIAL_TRANSITION)
self.adjust_lights([entity_id], self._initial_transition)
except:
pass
@ -344,7 +344,7 @@ class CircadianSwitch(SwitchDevice, RestoreEntity):
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(CONF_INITIAL_TRANSITION)
self.update_switch(self._initial_transition)
except:
pass
@ -352,6 +352,6 @@ class CircadianSwitch(SwitchDevice, RestoreEntity):
try:
_LOGGER.debug(entity_id + " change from " + str(from_state) + " to " + str(to_state))
if from_state.state == self._disable_state:
self.update_switch(CONF_INITIAL_TRANSITION)
self.update_switch(self._initial_transition)
except:
pass