1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Refactor ZHA Entity availability tracking (#36645)

* Refactor ZHA entity availability

ZHA entity availability tracks on underlying ZHA device availability.

* Update device status without signal.

* Update tests.

* Fix tests.

* Tests for restored devices availability.

* Guard against empty last_seen entry

Refactor device loading a bit.
This commit is contained in:
Alexei Chetroi
2020-06-11 17:21:08 -04:00
committed by GitHub
parent 0146f35687
commit 21acdbbbfd
16 changed files with 161 additions and 65 deletions

View File

@@ -117,6 +117,8 @@ async def test_fan(hass, zha_device_joined_restored, zigpy_device):
entity_id = await find_entity_id(DOMAIN, zha_device, hass)
assert entity_id is not None
assert hass.states.get(entity_id).state == STATE_OFF
await async_enable_traffic(hass, [zha_device], enabled=False)
# test that the fan was created and that it is unavailable
assert hass.states.get(entity_id).state == STATE_UNAVAILABLE