mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
FIx brightness always 100% when toggling the light (#153765)
Co-authored-by: Josef Zweck <josef@zweck.dev>
This commit is contained in:
committed by
GitHub
parent
80fd07c128
commit
c0ac3292cd
@@ -53,7 +53,7 @@ class NikoHomeControlLight(NikoHomeControlEntity, LightEntity):
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Instruct the light to turn on."""
|
||||
await self._action.turn_on(kwargs.get(ATTR_BRIGHTNESS, 255))
|
||||
await self._action.turn_on(kwargs.get(ATTR_BRIGHTNESS))
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Instruct the light to turn off."""
|
||||
|
||||
@@ -45,7 +45,7 @@ def dimmable_light() -> NHCLight:
|
||||
mock.is_dimmable = True
|
||||
mock.name = "dimmable light"
|
||||
mock.suggested_area = "room"
|
||||
mock.state = 255
|
||||
mock.state = 100
|
||||
return mock
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
# name: test_entities[light.dimmable_light-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'brightness': 255,
|
||||
'brightness': 100,
|
||||
'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
'friendly_name': 'dimmable light',
|
||||
'supported_color_modes': list([
|
||||
|
||||
@@ -42,7 +42,7 @@ async def test_entities(
|
||||
@pytest.mark.parametrize(
|
||||
("light_id", "data", "set_brightness"),
|
||||
[
|
||||
(0, {ATTR_ENTITY_ID: "light.light"}, 255),
|
||||
(0, {ATTR_ENTITY_ID: "light.light"}, None),
|
||||
(
|
||||
1,
|
||||
{ATTR_ENTITY_ID: "light.dimmable_light", ATTR_BRIGHTNESS: 50},
|
||||
@@ -119,7 +119,7 @@ async def test_updating(
|
||||
assert hass.states.get("light.light").state == STATE_OFF
|
||||
|
||||
assert hass.states.get("light.dimmable_light").state == STATE_ON
|
||||
assert hass.states.get("light.dimmable_light").attributes[ATTR_BRIGHTNESS] == 255
|
||||
assert hass.states.get("light.dimmable_light").attributes[ATTR_BRIGHTNESS] == 100
|
||||
|
||||
dimmable_light.state = 204
|
||||
await find_update_callback(mock_niko_home_control_connection, 2)(204)
|
||||
|
||||
Reference in New Issue
Block a user