From 773a955b858656ca031c9e354bf0d40e5bec22ff Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 5 Oct 2020 09:37:57 +0200 Subject: [PATCH] bug fix --- custom_components/adaptive_lighting/switch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 0ce86683..4fa0627f 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -980,7 +980,10 @@ class TurnOnOffListener: id_on_to_off = on_to_off_event.context.id turn_off_event = self.turn_off_event.get(entity_id) - transition = turn_off_event.data.get(ATTR_SERVICE_DATA, {}).get(ATTR_TRANSITION) + if turn_off_event is not None: + transition = turn_off_event.data[ATTR_SERVICE_DATA].get(ATTR_TRANSITION) + else: + transition = None turn_on_event = self.turn_on_event.get(entity_id) id_turn_on = turn_on_event.context.id