From 8ca5df6fcc9035a19a15cdd0a274c645b1be8b5d Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 25 Oct 2023 13:17:41 +0200 Subject: [PATCH] Guard for None color mode in ZHA (#102774) --- homeassistant/components/zha/light.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/zha/light.py b/homeassistant/components/zha/light.py index 6770ca3b563..6a01d550466 100644 --- a/homeassistant/components/zha/light.py +++ b/homeassistant/components/zha/light.py @@ -850,8 +850,8 @@ class Light(BaseLight, ZhaEntity): self._off_with_transition = last_state.attributes["off_with_transition"] if "off_brightness" in last_state.attributes: self._off_brightness = last_state.attributes["off_brightness"] - if "color_mode" in last_state.attributes: - self._attr_color_mode = ColorMode(last_state.attributes["color_mode"]) + if (color_mode := last_state.attributes.get("color_mode")) is not None: + self._attr_color_mode = ColorMode(color_mode) if "color_temp" in last_state.attributes: self._attr_color_temp = last_state.attributes["color_temp"] if "xy_color" in last_state.attributes: