Yeelight disable polling (#59885)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
starkillerOG 2021-11-19 16:02:07 +01:00 committed by GitHub
parent 14d4a9a69d
commit 2b7bcd6aeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -21,6 +21,7 @@ from homeassistant.const import (
CONF_HOST,
CONF_ID,
CONF_NAME,
STATE_ON,
STATE_UNAVAILABLE,
)
from homeassistant.core import HomeAssistant
@ -530,12 +531,14 @@ async def test_connection_dropped_resyncs_properties(hass: HomeAssistant):
assert len(mocked_bulb.async_get_properties.mock_calls) == 1
mocked_bulb._async_callback({KEY_CONNECTED: False})
await hass.async_block_till_done()
assert hass.states.get("light.test_name").state == STATE_UNAVAILABLE
assert len(mocked_bulb.async_get_properties.mock_calls) == 1
mocked_bulb._async_callback({KEY_CONNECTED: True})
async_fire_time_changed(
hass, dt_util.utcnow() + timedelta(seconds=STATE_CHANGE_TIME)
)
await hass.async_block_till_done()
assert hass.states.get("light.test_name").state == STATE_ON
assert len(mocked_bulb.async_get_properties.mock_calls) == 2