Workaround brightness transition delay from off in older yeelight models (#58774)
This commit is contained in:
parent
f94bbf351d
commit
faecc90b38
3 changed files with 39 additions and 1 deletions
|
@ -641,6 +641,25 @@ async def test_state_already_set_avoid_ratelimit(hass: HomeAssistant):
|
|||
mocked_bulb.async_set_rgb.reset_mock()
|
||||
mocked_bulb.last_properties["flowing"] = "0"
|
||||
|
||||
mocked_bulb.model = "color" # color model needs a workaround (see MODELS_WITH_DELAYED_ON_TRANSITION)
|
||||
await hass.services.async_call(
|
||||
"light",
|
||||
SERVICE_TURN_ON,
|
||||
{
|
||||
ATTR_ENTITY_ID: ENTITY_LIGHT,
|
||||
ATTR_BRIGHTNESS_PCT: PROPERTIES["bright"],
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
assert mocked_bulb.async_set_hsv.mock_calls == []
|
||||
assert mocked_bulb.async_set_rgb.mock_calls == []
|
||||
assert mocked_bulb.async_set_color_temp.mock_calls == []
|
||||
assert mocked_bulb.async_set_brightness.mock_calls == [
|
||||
call(pytest.approx(50.1, 0.1), duration=350, light_type=ANY)
|
||||
]
|
||||
mocked_bulb.async_set_brightness.reset_mock()
|
||||
|
||||
mocked_bulb.model = "colora" # colora does not need a workaround
|
||||
await hass.services.async_call(
|
||||
"light",
|
||||
SERVICE_TURN_ON,
|
||||
|
@ -683,6 +702,7 @@ async def test_state_already_set_avoid_ratelimit(hass: HomeAssistant):
|
|||
assert mocked_bulb.async_set_brightness.mock_calls == []
|
||||
|
||||
mocked_bulb.last_properties["flowing"] = "1"
|
||||
|
||||
await hass.services.async_call(
|
||||
"light",
|
||||
SERVICE_TURN_ON,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue