Round brightness in Niko Home Control (#135920)

This commit is contained in:
Glenn Vandeuren (aka Iondependent) 2025-01-19 12:51:05 +01:00 committed by Franck Nijhof
parent 11205f1c9d
commit 1bf1804492
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
2 changed files with 3 additions and 3 deletions

View File

@ -112,7 +112,7 @@ class NikoHomeControlLight(NikoHomeControlEntity, LightEntity):
def turn_on(self, **kwargs: Any) -> None:
"""Instruct the light to turn on."""
self._action.turn_on(kwargs.get(ATTR_BRIGHTNESS, 255) / 2.55)
self._action.turn_on(round(kwargs.get(ATTR_BRIGHTNESS, 255) / 2.55))
def turn_off(self, **kwargs: Any) -> None:
"""Instruct the light to turn off."""

View File

@ -42,11 +42,11 @@ async def test_entities(
@pytest.mark.parametrize(
("light_id", "data", "set_brightness"),
[
(0, {ATTR_ENTITY_ID: "light.light"}, 100.0),
(0, {ATTR_ENTITY_ID: "light.light"}, 100),
(
1,
{ATTR_ENTITY_ID: "light.dimmable_light", ATTR_BRIGHTNESS: 50},
19.607843137254903,
20,
),
],
)