Add guard for missing xy color support in Matter light platform (#97251)

This commit is contained in:
Marcel van der Veldt 2023-07-26 11:37:13 +02:00 committed by GitHub
parent 1a25b17c27
commit ae33670b33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -337,10 +337,16 @@ class MatterLight(MatterEntity, LightEntity):
# set current values
if self.supports_color:
self._attr_color_mode = self._get_color_mode()
if self._attr_color_mode == ColorMode.HS:
self._attr_color_mode = color_mode = self._get_color_mode()
if (
ColorMode.HS in self._attr_supported_color_modes
and color_mode == ColorMode.HS
):
self._attr_hs_color = self._get_hs_color()
else:
elif (
ColorMode.XY in self._attr_supported_color_modes
and color_mode == ColorMode.XY
):
self._attr_xy_color = self._get_xy_color()
if self.supports_color_temperature: