Fix deconz tests that have uncaught exceptions (#33462)

This commit is contained in:
Eugenio Panadero authored and GitHub committed 2020-03-31 11:19:34 -05:00
1 parent 977f1a6916
commit f2f03cf552
3 files changed
+7 -9

No files matched your search

@@ -86,9 +86,10 @@ class DeconzDevice(DeconzBase, Entity):
async def async_will_remove_from_hass(self) -> None:
"""Disconnect device object when removed."""
self._device.remove_callback(self.async_update_callback)
del self.gateway.deconz_ids[self.entity_id]
for unsub_dispatcher in self.listeners:
unsub_dispatcher()
if self.entity_id in self.gateway.deconz_ids:
del self.gateway.deconz_ids[self.entity_id]
for unsub_dispatcher in self.listeners:
unsub_dispatcher()
async def async_remove_self(self, deconz_ids: list) -> None:
"""Schedule removal of this entity.