UniFi - Change handling of updated options (#31762)

* Change handling of updated options

* Add tests
This commit is contained in:
Robert Svensson authored and GitHub committed 2020-02-12 16:15:08 -08:00
1 parent e0a035ce35
commit 4cac0443e2
5 files changed
+320 -98

No files matched your search

+4 -4
View File
@@ -164,7 +164,7 @@ class UniFiController:
WIRELESS_GUEST_CONNECTED,
):
self.update_wireless_clients()
else:
elif data.get("clients") or data.get("devices"):
async_dispatcher_send(self.hass, self.signal_update)
@property
@@ -238,13 +238,13 @@ class UniFiController:
self.api.start_websocket()
self.config_entry.add_update_listener(self.async_options_updated)
self.config_entry.add_update_listener(self.async_config_entry_updated)
return True
@staticmethod
async def async_options_updated(hass, entry):
"""Triggered by config entry options updates."""
async def async_config_entry_updated(hass, entry) -> None:
"""Handle signals of config entry being updated."""
controller_id = CONTROLLER_ID.format(
host=entry.data[CONF_CONTROLLER][CONF_HOST],
site=entry.data[CONF_CONTROLLER][CONF_SITE_ID],