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 authored and GitHub committed 2020-06-11 17:21:08 -04:00
1 parent 0146f35687
commit 21acdbbbfd
16 files changed
+161 -65

No files matched your search

+2 -2
View File
@@ -175,10 +175,10 @@ def async_find_group_entity_id(hass, domain, group):
return None
async def async_enable_traffic(hass, zha_devices):
async def async_enable_traffic(hass, zha_devices, enabled=True):
"""Allow traffic to flow through the gateway and the zha device."""
for zha_device in zha_devices:
zha_device.update_available(True)
zha_device.update_available(enabled)
await hass.async_block_till_done()