Fix deconz tests that have uncaught exceptions (#33462)

This commit is contained in:
Eugenio Panadero 2020-03-31 18:19:34 +02:00 committed by GitHub
parent 977f1a6916
commit f2f03cf552
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View file

@ -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.