Skip to content

Commit

Permalink
Merge pull request #325 from basnijholt/no_turn_on_event
Browse files Browse the repository at this point in the history
Take care of the turn_on_event not having registered an event for entity_id
  • Loading branch information
basnijholt authored Aug 30, 2022
2 parents f049c8d + 1642ae8 commit 61fff3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/adaptive_lighting/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"config_flow": true,
"dependencies": [],
"codeowners": ["@basnijholt", "@RubenKelevra"],
"version": "1.0.18",
"version": "1.0.19",
"requirements": [],
"iot_class": "calculated"
}
5 changes: 5 additions & 0 deletions custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,11 @@ async def maybe_cancel_adjusting(
transition = None

turn_on_event = self.turn_on_event.get(entity_id)
if turn_on_event is None:
# This means that the light never got a 'turn_on' call that we
# registered. I am not 100% sure why this happens, but it does.
# This is a fix for #170 and #232.
return False
id_turn_on = turn_on_event.context.id

id_off_to_on = off_to_on_event.context.id
Expand Down

0 comments on commit 61fff3e

Please sign in to comment.