mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Improve freedompro
generic typing (#84736)
This commit is contained in:
parent
50f05ac51a
commit
b8a4399078
@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Final
|
||||
from typing import Any, Final
|
||||
|
||||
from pyfreedompro import get_list, get_states
|
||||
|
||||
@ -60,14 +60,14 @@ async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> Non
|
||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
||||
|
||||
|
||||
class FreedomproDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
class FreedomproDataUpdateCoordinator(DataUpdateCoordinator[list[dict[str, Any]]]):
|
||||
"""Class to manage fetching Freedompro data API."""
|
||||
|
||||
def __init__(self, hass, api_key):
|
||||
"""Initialize."""
|
||||
self._hass = hass
|
||||
self._api_key = api_key
|
||||
self._devices = None
|
||||
self._devices: list[dict[str, Any]] | None = None
|
||||
|
||||
update_interval = timedelta(minutes=1)
|
||||
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)
|
||||
|
@ -43,7 +43,7 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class Device(CoordinatorEntity, BinarySensorEntity):
|
||||
class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], BinarySensorEntity):
|
||||
"""Representation of an Freedompro binary_sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -45,7 +45,7 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class Device(CoordinatorEntity, CoverEntity):
|
||||
class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], CoverEntity):
|
||||
"""Representation of an Freedompro cover."""
|
||||
|
||||
def __init__(
|
||||
|
@ -37,7 +37,7 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class Device(CoordinatorEntity, LightEntity):
|
||||
class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], LightEntity):
|
||||
"""Representation of an Freedompro light."""
|
||||
|
||||
def __init__(
|
||||
|
Loading…
x
Reference in New Issue
Block a user