mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
parent
7768084655
commit
d849dab7ba
@ -34,9 +34,11 @@ async def async_setup_entry(
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up sensors."""
|
||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||
coordinator: DataUpdateCoordinator[dict[str, OncueDevice]] = hass.data[DOMAIN][
|
||||
config_entry.entry_id
|
||||
]
|
||||
entities: list[OncueBinarySensorEntity] = []
|
||||
devices: dict[str, OncueDevice] = coordinator.data
|
||||
devices = coordinator.data
|
||||
for device_id, device in devices.items():
|
||||
entities.extend(
|
||||
OncueBinarySensorEntity(
|
||||
|
@ -14,12 +14,14 @@ from homeassistant.helpers.update_coordinator import (
|
||||
from .const import CONNECTION_ESTABLISHED_KEY, DOMAIN, VALUE_UNAVAILABLE
|
||||
|
||||
|
||||
class OncueEntity(CoordinatorEntity, Entity):
|
||||
class OncueEntity(
|
||||
CoordinatorEntity[DataUpdateCoordinator[dict[str, OncueDevice]]], Entity
|
||||
):
|
||||
"""Representation of an Oncue entity."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
coordinator: DataUpdateCoordinator[dict[str, OncueDevice]],
|
||||
device_id: str,
|
||||
device: OncueDevice,
|
||||
sensor: OncueSensor,
|
||||
|
@ -183,9 +183,11 @@ async def async_setup_entry(
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up sensors."""
|
||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||
coordinator: DataUpdateCoordinator[dict[str, OncueDevice]] = hass.data[DOMAIN][
|
||||
config_entry.entry_id
|
||||
]
|
||||
entities: list[OncueSensorEntity] = []
|
||||
devices: dict[str, OncueDevice] = coordinator.data
|
||||
devices = coordinator.data
|
||||
for device_id, device in devices.items():
|
||||
entities.extend(
|
||||
OncueSensorEntity(coordinator, device_id, device, sensor, SENSOR_MAP[key])
|
||||
@ -201,7 +203,7 @@ class OncueSensorEntity(OncueEntity, SensorEntity):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
coordinator: DataUpdateCoordinator[dict[str, OncueDevice]],
|
||||
device_id: str,
|
||||
device: OncueDevice,
|
||||
sensor: OncueSensor,
|
||||
|
Loading…
x
Reference in New Issue
Block a user