Improve `lyric` generic typing (#84637)
parent
44e37a8026
commit
b01efc55a2
|
@ -105,7 +105,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
except (LyricException, ClientResponseError) as exception:
|
||||
raise UpdateFailed(exception) from exception
|
||||
|
||||
coordinator = DataUpdateCoordinator(
|
||||
coordinator = DataUpdateCoordinator[Lyric](
|
||||
hass,
|
||||
_LOGGER,
|
||||
# Name of the data. For logging purposes.
|
||||
|
@ -133,12 +133,12 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
return unload_ok
|
||||
|
||||
|
||||
class LyricEntity(CoordinatorEntity):
|
||||
class LyricEntity(CoordinatorEntity[DataUpdateCoordinator[Lyric]]):
|
||||
"""Defines a base Honeywell Lyric entity."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
coordinator: DataUpdateCoordinator[Lyric],
|
||||
location: LyricLocation,
|
||||
device: LyricDevice,
|
||||
key: str,
|
||||
|
|
|
@ -6,6 +6,7 @@ import logging
|
|||
from time import localtime, strftime, time
|
||||
from typing import Any
|
||||
|
||||
from aiolyric import Lyric
|
||||
from aiolyric.objects.device import LyricDevice
|
||||
from aiolyric.objects.location import LyricLocation
|
||||
import voluptuous as vol
|
||||
|
@ -97,7 +98,7 @@ async def async_setup_entry(
|
|||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up the Honeywell Lyric climate platform based on a config entry."""
|
||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
coordinator: DataUpdateCoordinator[Lyric] = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
entities = []
|
||||
|
||||
|
@ -130,12 +131,12 @@ async def async_setup_entry(
|
|||
class LyricClimate(LyricDeviceEntity, ClimateEntity):
|
||||
"""Defines a Honeywell Lyric climate entity."""
|
||||
|
||||
coordinator: DataUpdateCoordinator
|
||||
coordinator: DataUpdateCoordinator[Lyric]
|
||||
entity_description: ClimateEntityDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
coordinator: DataUpdateCoordinator[Lyric],
|
||||
description: ClimateEntityDescription,
|
||||
location: LyricLocation,
|
||||
device: LyricDevice,
|
||||
|
|
|
@ -6,6 +6,7 @@ from dataclasses import dataclass
|
|||
from datetime import datetime, timedelta
|
||||
from typing import cast
|
||||
|
||||
from aiolyric import Lyric
|
||||
from aiolyric.objects.device import LyricDevice
|
||||
from aiolyric.objects.location import LyricLocation
|
||||
|
||||
|
@ -63,7 +64,7 @@ async def async_setup_entry(
|
|||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up the Honeywell Lyric sensor platform based on a config entry."""
|
||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
coordinator: DataUpdateCoordinator[Lyric] = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
entities = []
|
||||
|
||||
|
@ -179,12 +180,12 @@ async def async_setup_entry(
|
|||
class LyricSensor(LyricDeviceEntity, SensorEntity):
|
||||
"""Define a Honeywell Lyric sensor."""
|
||||
|
||||
coordinator: DataUpdateCoordinator
|
||||
coordinator: DataUpdateCoordinator[Lyric]
|
||||
entity_description: LyricSensorEntityDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
coordinator: DataUpdateCoordinator[Lyric],
|
||||
description: LyricSensorEntityDescription,
|
||||
location: LyricLocation,
|
||||
device: LyricDevice,
|
||||
|
|
Loading…
Reference in New Issue