UniFi - Improve controller tests (#27261)

* Improve controller tests and harmonize setup_unifi_integration to one
* Store listeners to dispatchers to be used during reset
This commit is contained in:
Robert Svensson authored and GitHub committed 2019-10-07 21:55:35 +02:00
1 parent 1febb32dd9
commit 6565c17828
10 files changed
+401 -583

No files matched your search

+7 -3
View File
@@ -31,7 +31,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
"""Update the values of the controller."""
update_items(controller, async_add_entities, sensors)
async_dispatcher_connect(hass, controller.signal_update, update_controller)
controller.listeners.append(
async_dispatcher_connect(hass, controller.signal_update, update_controller)
)
@callback
def update_disable_on_entities():
@@ -46,8 +48,10 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
entity.registry_entry.entity_id, disabled_by=disabled_by
)
async_dispatcher_connect(
hass, controller.signal_options_update, update_disable_on_entities
controller.listeners.append(
async_dispatcher_connect(
hass, controller.signal_options_update, update_disable_on_entities
)
)
update_controller()