UniFi - Improve signalling and handling of adding new entities (#34925)

* Change signalling and handling of adding devices

* Bump aiounifi to v19
Use the proper variable for roamradio
This commit is contained in:
Robert Svensson 2020-05-04 19:29:49 +02:00 committed by GitHub
parent dbf383f713
commit c5ce95ff06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 312 additions and 109 deletions

View file

@ -1,10 +1,13 @@
"""Base class for UniFi entities."""
import logging
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_registry import async_entries_for_device
LOGGER = logging.getLogger(__name__)
class UniFiBase(Entity):
"""UniFi entity base class."""
@ -27,6 +30,7 @@ class UniFiBase(Entity):
async def async_added_to_hass(self) -> None:
"""Entity created."""
LOGGER.debug("New %s entity %s (%s)", self.TYPE, self.entity_id, self.mac)
for signal, method in (
(self.controller.signal_reachable, self.async_update_callback),
(self.controller.signal_options_update, self.options_updated),