Use runtime_data for elgato (#116614)
This commit is contained in:
parent
95405ba6bb
commit
8c053a351c
7 changed files with 22 additions and 30 deletions
|
@ -9,13 +9,12 @@ from typing import Any
|
|||
from elgato import Elgato, ElgatoError
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import DOMAIN
|
||||
from . import ElgatorConfigEntry
|
||||
from .coordinator import ElgatoData, ElgatoDataUpdateCoordinator
|
||||
from .entity import ElgatoEntity
|
||||
|
||||
|
@ -53,11 +52,11 @@ SWITCHES = [
|
|||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
entry: ElgatorConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up Elgato switches based on a config entry."""
|
||||
coordinator: ElgatoDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
coordinator = entry.runtime_data
|
||||
|
||||
async_add_entities(
|
||||
ElgatoSwitchEntity(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue