Fix hue fallback onoff colormode (#109856)

Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
This commit is contained in:
Erik Montnemery 2024-02-07 08:14:55 +01:00 committed by GitHub
parent d9f97bc7ec
commit b420c65016
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -94,6 +94,9 @@ class HueLight(HueBaseEntity, LightEntity):
self._supported_color_modes.add(ColorMode.BRIGHTNESS)
# support transition if brightness control
self._attr_supported_features |= LightEntityFeature.TRANSITION
if len(self._supported_color_modes) == 0:
# only add onoff colormode as fallback
self._supported_color_modes.add(ColorMode.ONOFF)
self._last_brightness: float | None = None
self._color_temp_active: bool = False
# get list of supported effects (combine effects and timed_effects)

View File

@ -72,7 +72,7 @@ async def test_lights(
assert light_4.attributes["friendly_name"] == "Hue on/off light"
assert light_4.state == "off"
assert light_4.attributes["mode"] == "normal"
assert light_4.attributes["supported_color_modes"] == []
assert light_4.attributes["supported_color_modes"] == [ColorMode.ONOFF]
async def test_light_turn_on_service(