Use config entry runtime data in Scrape (#118191)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
4d52d920ee
commit
e6142985a5
2 changed files with 10 additions and 10 deletions
|
@ -9,7 +9,6 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.sensor import CONF_STATE_CLASS, SensorDeviceClass
|
||||
from homeassistant.components.sensor.helpers import async_parse_date_datetime
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_ATTRIBUTE,
|
||||
CONF_DEVICE_CLASS,
|
||||
|
@ -34,6 +33,7 @@ from homeassistant.helpers.trigger_template_entity import (
|
|||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from . import ScrapeConfigEntry
|
||||
from .const import CONF_INDEX, CONF_SELECT, DOMAIN
|
||||
from .coordinator import ScrapeCoordinator
|
||||
|
||||
|
@ -94,12 +94,14 @@ async def async_setup_platform(
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
hass: HomeAssistant,
|
||||
entry: ScrapeConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the Scrape sensor entry."""
|
||||
entities: list = []
|
||||
|
||||
coordinator: ScrapeCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
coordinator = entry.runtime_data
|
||||
config = dict(entry.options)
|
||||
for sensor in config["sensor"]:
|
||||
sensor_config: ConfigType = vol.Schema(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue