Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix set brightness for Netatmo lights #126075

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions homeassistant/components/netatmo/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
joostlek marked this conversation as resolved.
Show resolved Hide resolved
)

else:
await self.device.async_on()
Expand All @@ -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