Migrate hunterdouglas_powerview to use entry.runtime_data (#121887)
This commit is contained in:
parent
2dec7136c8
commit
62613af033
10 changed files with 46 additions and 69 deletions
|
@ -13,15 +13,13 @@ from homeassistant.components.sensor import (
|
|||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import PERCENTAGE, SIGNAL_STRENGTH_DECIBELS, EntityCategory
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import PowerviewShadeUpdateCoordinator
|
||||
from .entity import ShadeEntity
|
||||
from .model import PowerviewDeviceInfo, PowerviewEntryData
|
||||
from .model import PowerviewConfigEntry, PowerviewDeviceInfo
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
@ -79,12 +77,12 @@ SENSORS: Final = [
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
hass: HomeAssistant,
|
||||
entry: PowerviewConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the hunter douglas sensor entities."""
|
||||
|
||||
pv_entry: PowerviewEntryData = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
pv_entry = entry.runtime_data
|
||||
entities: list[PowerViewSensor] = []
|
||||
for shade in pv_entry.shade_data.values():
|
||||
room_name = getattr(pv_entry.room_data.get(shade.room_id), ATTR_NAME, "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue