Fix Netatmo light switching states by assuming state until next update (#106162)

pull/106180/head
Tobias Sauerwein 2023-12-22 07:37:57 +01:00 committed by GitHub
parent 8918a9c2c4
commit 7ef20c4431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -186,11 +186,6 @@ class NetatmoLight(NetatmoBase, LightEntity):
]
)
@property
def is_on(self) -> bool:
"""Return true if light is on."""
return self._dimmer.on is True
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn light on."""
if ATTR_BRIGHTNESS in kwargs:
@ -211,6 +206,8 @@ class NetatmoLight(NetatmoBase, LightEntity):
@callback
def async_update_callback(self) -> None:
"""Update the entity's state."""
self._attr_is_on = self._dimmer.on is True
if self._dimmer.brightness is not None:
# Netatmo uses a range of [0, 100] to control brightness
self._attr_brightness = round((self._dimmer.brightness / 100) * 255)