to_state will always be on

This commit is contained in:
Bas Nijholt 2020-09-05 15:08:26 +02:00 committed by GitHub
commit 37ac31c3c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -382,7 +382,8 @@ class CircadianSwitch(SwitchEntity, RestoreEntity):
await asyncio.wait(tasks)
async def _light_state_changed(self, entity_id, from_state, to_state):
if to_state.state == "on" and (from_state is None or from_state.state != "on"):
assert to_state.state == "on"
if from_state is None or from_state.state != "on":
_LOGGER.debug(_difference_between_states(from_state, to_state))
await self._force_update_switch(lights=[entity_id])