mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
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 <joostlek@outlook.com>
This commit is contained in:
parent
c64222de4f
commit
d924fc5967
@ -173,7 +173,9 @@ class NetatmoLight(NetatmoModuleEntity, LightEntity):
|
|||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn light on."""
|
"""Turn light on."""
|
||||||
if ATTR_BRIGHTNESS in kwargs:
|
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:
|
else:
|
||||||
await self.device.async_on()
|
await self.device.async_on()
|
||||||
@ -194,6 +196,6 @@ class NetatmoLight(NetatmoModuleEntity, LightEntity):
|
|||||||
|
|
||||||
if (brightness := self.device.brightness) is not None:
|
if (brightness := self.device.brightness) is not None:
|
||||||
# Netatmo uses a range of [0, 100] to control brightness
|
# 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:
|
else:
|
||||||
self._attr_brightness = None
|
self._attr_brightness = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user