mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Round brightness in Niko Home Control (#135920)
This commit is contained in:
parent
11205f1c9d
commit
1bf1804492
@ -112,7 +112,7 @@ class NikoHomeControlLight(NikoHomeControlEntity, LightEntity):
|
|||||||
|
|
||||||
def turn_on(self, **kwargs: Any) -> None:
|
def turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Instruct the light to turn on."""
|
"""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:
|
def turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Instruct the light to turn off."""
|
"""Instruct the light to turn off."""
|
||||||
|
@ -42,11 +42,11 @@ async def test_entities(
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("light_id", "data", "set_brightness"),
|
("light_id", "data", "set_brightness"),
|
||||||
[
|
[
|
||||||
(0, {ATTR_ENTITY_ID: "light.light"}, 100.0),
|
(0, {ATTR_ENTITY_ID: "light.light"}, 100),
|
||||||
(
|
(
|
||||||
1,
|
1,
|
||||||
{ATTR_ENTITY_ID: "light.dimmable_light", ATTR_BRIGHTNESS: 50},
|
{ATTR_ENTITY_ID: "light.dimmable_light", ATTR_BRIGHTNESS: 50},
|
||||||
19.607843137254903,
|
20,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user