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