From 19592788d4a75d4a6992b37fee78130ef68121b8 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 31 Jul 2023 18:53:52 -0700 Subject: [PATCH] fix --- custom_components/adaptive_lighting/switch.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index ad2bd7a9..05d8a89d 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -2156,7 +2156,13 @@ class AdaptiveLightingManager: def start_transition_timer(self, light: str) -> None: """Mark a light as manually controlled.""" - last_service_data = self.last_service_data[light] + last_service_data = self.last_service_data.get(light) + if last_service_data is None: + _LOGGER.debug( + "No last service data for light %s, continuing...", + light, + ) + return last_transition = last_service_data.get(ATTR_TRANSITION) if not last_transition: _LOGGER.debug(