Skip to content

Commit

Permalink
Round brightness in Niko Home Control (#135920)
Browse files Browse the repository at this point in the history
  • Loading branch information
VandeurenGlenn authored Jan 19, 2025
1 parent 5a91562 commit 9f3b39a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/niko_home_control/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(

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."""
Expand Down
4 changes: 2 additions & 2 deletions tests/components/niko_home_control/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
],
)
Expand Down

0 comments on commit 9f3b39a

Please sign in to comment.