Bump aiounifi to v45 (#90250)
* Bump aiounifi to v45 * Replace local TypeVar with library TypeVar
This commit is contained in:
parent
e17cefd61c
commit
7f1fff12ef
7 changed files with 31 additions and 36 deletions
|
@ -14,6 +14,7 @@ import aiounifi
|
|||
from aiounifi.interfaces.api_handlers import ItemEvent
|
||||
from aiounifi.interfaces.clients import Clients
|
||||
from aiounifi.interfaces.ports import Ports
|
||||
from aiounifi.models.api import ApiItemT
|
||||
from aiounifi.models.client import Client
|
||||
from aiounifi.models.port import Port
|
||||
|
||||
|
@ -33,7 +34,6 @@ import homeassistant.util.dt as dt_util
|
|||
from .const import DOMAIN as UNIFI_DOMAIN
|
||||
from .controller import UniFiController
|
||||
from .entity import (
|
||||
DataT,
|
||||
HandlerT,
|
||||
UnifiEntity,
|
||||
UnifiEntityDescription,
|
||||
|
@ -80,17 +80,17 @@ def async_client_device_info_fn(api: aiounifi.Controller, obj_id: str) -> Device
|
|||
|
||||
|
||||
@dataclass
|
||||
class UnifiSensorEntityDescriptionMixin(Generic[HandlerT, DataT]):
|
||||
class UnifiSensorEntityDescriptionMixin(Generic[HandlerT, ApiItemT]):
|
||||
"""Validate and load entities from different UniFi handlers."""
|
||||
|
||||
value_fn: Callable[[UniFiController, DataT], datetime | float | str | None]
|
||||
value_fn: Callable[[UniFiController, ApiItemT], datetime | float | str | None]
|
||||
|
||||
|
||||
@dataclass
|
||||
class UnifiSensorEntityDescription(
|
||||
SensorEntityDescription,
|
||||
UnifiEntityDescription[HandlerT, DataT],
|
||||
UnifiSensorEntityDescriptionMixin[HandlerT, DataT],
|
||||
UnifiEntityDescription[HandlerT, ApiItemT],
|
||||
UnifiSensorEntityDescriptionMixin[HandlerT, ApiItemT],
|
||||
):
|
||||
"""Class describing UniFi sensor entity."""
|
||||
|
||||
|
@ -182,10 +182,10 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class UnifiSensorEntity(UnifiEntity[HandlerT, DataT], SensorEntity):
|
||||
class UnifiSensorEntity(UnifiEntity[HandlerT, ApiItemT], SensorEntity):
|
||||
"""Base representation of a UniFi sensor."""
|
||||
|
||||
entity_description: UnifiSensorEntityDescription[HandlerT, DataT]
|
||||
entity_description: UnifiSensorEntityDescription[HandlerT, ApiItemT]
|
||||
|
||||
@callback
|
||||
def async_update_state(self, event: ItemEvent, obj_id: str) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue