UniFi - Store controller in config_entry.entry_id (#34553)
* Store controller in config_entry.entry_id * Clean up imports
This commit is contained in:
1 parent
a0fbf9ba47
commit
c3689d7416
13 files changed
+190
-182
No files matched your search
@@ -17,7 +17,7 @@ from aiounifi.events import WIRELESS_CLIENT_CONNECTED, WIRELESS_GUEST_CONNECTED
|
||||
from aiounifi.websocket import STATE_DISCONNECTED, STATE_RUNNING
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components.device_tracker import DOMAIN as DT_DOMAIN
|
||||
from homeassistant.components.device_tracker import DOMAIN as TRACKER_DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import CONF_HOST
|
||||
@@ -46,14 +46,14 @@ from .const import (
|
||||
DEFAULT_TRACK_CLIENTS,
|
||||
DEFAULT_TRACK_DEVICES,
|
||||
DEFAULT_TRACK_WIRED_CLIENTS,
|
||||
DOMAIN,
|
||||
DOMAIN as UNIFI_DOMAIN,
|
||||
LOGGER,
|
||||
UNIFI_WIRELESS_CLIENTS,
|
||||
)
|
||||
from .errors import AuthenticationRequired, CannotConnect
|
||||
|
||||
RETRY_TIMER = 15
|
||||
SUPPORTED_PLATFORMS = [DT_DOMAIN, SENSOR_DOMAIN, SWITCH_DOMAIN]
|
||||
SUPPORTED_PLATFORMS = [TRACKER_DOMAIN, SENSOR_DOMAIN, SWITCH_DOMAIN]
|
||||
|
||||
|
||||
class UniFiController:
|
||||
@@ -283,14 +283,9 @@ class UniFiController:
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
async def async_config_entry_updated(hass, entry) -> None:
|
||||
async def async_config_entry_updated(hass, config_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],
|
||||
)
|
||||
controller = hass.data[DOMAIN][controller_id]
|
||||
|
||||
controller = hass.data[UNIFI_DOMAIN][config_entry.entry_id]
|
||||
async_dispatcher_send(hass, controller.signal_options_update)
|
||||
|
||||
@callback
|
||||
|
||||
Reference in new issue
Block a user