Fix light color mode in netatmo (#108759)

This commit is contained in:
Erik Montnemery 2024-01-24 15:29:16 +01:00 committed by GitHub
parent afbd71514f
commit 97e038eb2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View file

@ -64,7 +64,9 @@ async def async_setup_entry(
class NetatmoCameraLight(NetatmoBaseEntity, LightEntity):
"""Representation of a Netatmo Presence camera light."""
_attr_color_mode = ColorMode.ONOFF
_attr_has_entity_name = True
_attr_supported_color_modes = {ColorMode.ONOFF}
def __init__(
self,
@ -170,10 +172,11 @@ class NetatmoLight(NetatmoBaseEntity, LightEntity):
self._attr_brightness = 0
self._attr_unique_id = f"{self._id}-light"
self._attr_supported_color_modes: set[str] = set()
if not self._attr_supported_color_modes and self._dimmer.brightness is not None:
self._attr_supported_color_modes.add(ColorMode.BRIGHTNESS)
if self._dimmer.brightness is not None:
self._attr_color_mode = ColorMode.BRIGHTNESS
else:
self._attr_color_mode = ColorMode.ONOFF
self._attr_supported_color_modes = {self._attr_color_mode}
self._signal_name = f"{HOME}-{self._home_id}"
self._publishers.extend(

View file

@ -6,6 +6,7 @@
'area_id': None,
'capabilities': dict({
'supported_color_modes': list([
<ColorMode.ONOFF: 'onoff'>,
]),
}),
'config_entry_id': <ANY>,
@ -40,6 +41,7 @@
'color_mode': None,
'friendly_name': 'Bathroom light',
'supported_color_modes': list([
<ColorMode.ONOFF: 'onoff'>,
]),
'supported_features': <LightEntityFeature: 0>,
}),