Merge pull request #325 from basnijholt/no_turn_on_event

Take care of the turn_on_event not having registered an event for entity_id
This commit is contained in:
Bas Nijholt 2022-08-30 10:39:12 -07:00 committed by GitHub
commit 61fff3e95b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -6,7 +6,7 @@
"config_flow": true,
"dependencies": [],
"codeowners": ["@basnijholt", "@RubenKelevra"],
"version": "1.0.18",
"version": "1.0.19",
"requirements": [],
"iot_class": "calculated"
}

View file

@ -1512,6 +1512,11 @@ class TurnOnOffListener:
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