Use runtime_data for wled (#116615)

This commit is contained in:
Marc Mueller 2024-05-06 19:19:47 +02:00 committed by GitHub
parent f92fb0f492
commit f5c54bcc0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 38 additions and 51 deletions

View file

@ -9,12 +9,12 @@ from functools import partial
from wled import Segment
from homeassistant.components.number import NumberEntity, NumberEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import ATTR_INTENSITY, ATTR_SPEED, DOMAIN
from . import WLEDConfigEntry
from .const import ATTR_INTENSITY, ATTR_SPEED
from .coordinator import WLEDDataUpdateCoordinator
from .helpers import wled_exception_handler
from .models import WLEDEntity
@ -24,11 +24,11 @@ PARALLEL_UPDATES = 1
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: WLEDConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up WLED number based on a config entry."""
coordinator: WLEDDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
coordinator = entry.runtime_data
update_segments = partial(
async_update_segments,