Migrate screenlogic to use entry.runtime_data (#121644)

This commit is contained in:
J. Nick Koston 2024-07-09 23:36:02 -07:00 committed by GitHub
parent 6f15352eda
commit fb758bd8b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 50 additions and 67 deletions

View file

@ -18,12 +18,10 @@ from homeassistant.components.sensor import (
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN as SL_DOMAIN
from .coordinator import ScreenlogicDataUpdateCoordinator
from .entity import (
ScreenLogicEntity,
@ -31,6 +29,7 @@ from .entity import (
ScreenLogicPushEntity,
ScreenLogicPushEntityDescription,
)
from .types import ScreenLogicConfigEntry
from .util import cleanup_excluded_entity, get_ha_unit
_LOGGER = logging.getLogger(__name__)
@ -227,13 +226,11 @@ SUPPORTED_SCG_SENSORS = [
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
config_entry: ScreenLogicConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up entry."""
coordinator: ScreenlogicDataUpdateCoordinator = hass.data[SL_DOMAIN][
config_entry.entry_id
]
coordinator = config_entry.runtime_data
gateway = coordinator.gateway
entities: list[ScreenLogicSensor] = [