Store runtime data in entry in Ecovacs (#116445)

This commit is contained in:
Robert Resch 2024-04-30 22:44:56 +02:00 committed by GitHub
parent 2e9b1916c0
commit 1641df18ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 79 additions and 80 deletions

View file

@ -24,7 +24,6 @@ from homeassistant.components.sensor import (
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
AREA_SQUARE_METERS,
ATTR_BATTERY_LEVEL,
@ -37,8 +36,8 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from .const import DOMAIN, SUPPORTED_LIFESPANS
from .controller import EcovacsController
from . import EcovacsConfigEntry
from .const import SUPPORTED_LIFESPANS
from .entity import (
CapabilityDevice,
EcovacsCapabilityEntityDescription,
@ -171,11 +170,11 @@ LIFESPAN_ENTITY_DESCRIPTIONS = tuple(
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
config_entry: EcovacsConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Add entities for passed config_entry in HA."""
controller: EcovacsController = hass.data[DOMAIN][config_entry.entry_id]
controller = config_entry.runtime_data
entities: list[EcovacsEntity] = get_supported_entitites(
controller, EcovacsSensor, ENTITY_DESCRIPTIONS