deCONZ - move event handling (#40424)
* Working draft * Remove event references in sensor
This commit is contained in:
parent
6e8e4eedb5
commit
fb7fb0ea78
3 changed files with 48 additions and 17 deletions
|
@ -25,6 +25,7 @@ from .const import (
|
|||
NEW_SENSOR,
|
||||
SUPPORTED_PLATFORMS,
|
||||
)
|
||||
from .deconz_event import async_setup_events, async_unload_events
|
||||
from .errors import AuthenticationRequired, CannotConnect
|
||||
|
||||
|
||||
|
@ -112,6 +113,8 @@ class DeconzGateway:
|
|||
)
|
||||
)
|
||||
|
||||
self.hass.async_create_task(async_setup_events(self))
|
||||
|
||||
self.api.start()
|
||||
|
||||
self.config_entry.add_update_listener(self.async_config_entry_updated)
|
||||
|
@ -227,9 +230,7 @@ class DeconzGateway:
|
|||
unsub_dispatcher()
|
||||
self.listeners = []
|
||||
|
||||
for event in self.events:
|
||||
event.async_will_remove_from_hass()
|
||||
self.events.clear()
|
||||
await async_unload_events(self)
|
||||
|
||||
self.deconz_ids = {}
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue