UniFi - Store controller in config_entry.entry_id (#34553)

* Store controller in config_entry.entry_id

* Clean up imports
This commit is contained in:
Robert Svensson authored and GitHub committed 2020-04-23 16:48:24 +02:00
1 parent a0fbf9ba47
commit c3689d7416
13 files changed
+190 -182

No files matched your search

+2 -2
View File
@@ -2,11 +2,11 @@
import logging
from homeassistant.components.sensor import DOMAIN
from homeassistant.components.unifi.config_flow import get_controller_from_config_entry
from homeassistant.const import DATA_MEGABYTES
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import DOMAIN as UNIFI_DOMAIN
from .unifi_client import UniFiClient
LOGGER = logging.getLogger(__name__)
@@ -21,7 +21,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up sensors for UniFi integration."""
controller = get_controller_from_config_entry(hass, config_entry)
controller = hass.data[UNIFI_DOMAIN][config_entry.entry_id]
controller.entities[DOMAIN] = {RX_SENSOR: set(), TX_SENSOR: set()}
@callback