From 01688946b3abfcde2c64cde958560ec78b63998f Mon Sep 17 00:00:00 2001 From: Tobias Sauerwein Date: Tue, 17 Sep 2024 16:34:26 +0200 Subject: [PATCH] Fix set brightness for Netatmo lights (#126075) * fix set brightness for Netatmo lights * round returns int by default * Update homeassistant/components/netatmo/light.py --------- Co-authored-by: Joost Lekkerkerker --- homeassistant/components/netatmo/light.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/netatmo/light.py b/homeassistant/components/netatmo/light.py index b1871e9dabb7f4..fe30dc0eaa481c 100644 --- a/homeassistant/components/netatmo/light.py +++ b/homeassistant/components/netatmo/light.py @@ -173,7 +173,9 @@ def __init__(self, netatmo_device: NetatmoDevice) -> None: async def async_turn_on(self, **kwargs: Any) -> None: """Turn light on.""" if ATTR_BRIGHTNESS in kwargs: - await self.device.async_set_brightness(kwargs[ATTR_BRIGHTNESS]) + await self.device.async_set_brightness( + round(kwargs[ATTR_BRIGHTNESS] / 2.55) + ) else: await self.device.async_on() @@ -194,6 +196,6 @@ def async_update_callback(self) -> None: if (brightness := self.device.brightness) is not None: # Netatmo uses a range of [0, 100] to control brightness - self._attr_brightness = round((brightness / 100) * 255) + self._attr_brightness = round(brightness * 2.55) else: self._attr_brightness = None