* Adding coordinator for omada device list * Remove dead omada devices at startup * Tidy up tests * Address PR feedback * Returned to use of read-only properties for coordinators. Tidied up parameters some more * Update homeassistant/components/tplink_omada/controller.py * Update homeassistant/components/tplink_omada/controller.py * Update homeassistant/components/tplink_omada/controller.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
27 lines
921 B
Python
27 lines
921 B
Python
"""Base entity definitions."""
|
|
|
|
from typing import Any
|
|
|
|
from tplink_omada_client.devices import OmadaDevice
|
|
|
|
from homeassistant.helpers import device_registry as dr
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
from .const import DOMAIN
|
|
from .coordinator import OmadaCoordinator
|
|
|
|
|
|
class OmadaDeviceEntity[_T: OmadaCoordinator[Any]](CoordinatorEntity[_T]):
|
|
"""Common base class for all entities associated with Omada SDN Devices."""
|
|
|
|
def __init__(self, coordinator: _T, device: OmadaDevice) -> None:
|
|
"""Initialize the device."""
|
|
super().__init__(coordinator)
|
|
self.device = device
|
|
self._attr_device_info = dr.DeviceInfo(
|
|
connections={(dr.CONNECTION_NETWORK_MAC, device.mac)},
|
|
identifiers={(DOMAIN, device.mac)},
|
|
manufacturer="TP-Link",
|
|
model=device.model_display_name,
|
|
name=device.name,
|
|
)
|