Guard for None color mode in ZHA (#102774)

pull/98968/head
Joost Lekkerkerker 2023-10-25 13:17:41 +02:00 committed by GitHub
parent 0658c7b307
commit 8ca5df6fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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: