Cleanup ZHA group entity lifecycle (#33977)

* Clean up ZHA group entity lifecycle

* group entities don't use state restore

* add tests
This commit is contained in:
David F. Mulcahey 2020-04-10 16:17:48 -04:00 committed by GitHub
parent 14c35c9223
commit 13dda7bd98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 125 additions and 45 deletions

View file

@ -561,7 +561,15 @@ class ZHADevice(LogMixin):
async def async_remove_from_group(self, group_id):
"""Remove this device from the provided zigbee group."""
await self._zigpy_device.remove_from_group(group_id)
try:
await self._zigpy_device.remove_from_group(group_id)
except (zigpy.exceptions.DeliveryError, asyncio.TimeoutError) as ex:
self.debug(
"Failed to remove device '%s' from group: 0x%04x ex: %s",
self._zigpy_device.ieee,
group_id,
str(ex),
)
async def async_bind_to_group(self, group_id, cluster_bindings):
"""Directly bind this device to a group for the given clusters."""