mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Set config_entry explicitely in scrape coordinator (#129416)
This commit is contained in:
parent
02928601ef
commit
10fdf819d3
@ -72,7 +72,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
scan_interval: timedelta = resource_config.get(
|
scan_interval: timedelta = resource_config.get(
|
||||||
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL
|
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL
|
||||||
)
|
)
|
||||||
coordinator = ScrapeCoordinator(hass, rest, scan_interval)
|
coordinator = ScrapeCoordinator(hass, None, rest, scan_interval)
|
||||||
|
|
||||||
sensors: list[ConfigType] = resource_config.get(SENSOR_DOMAIN, [])
|
sensors: list[ConfigType] = resource_config.get(SENSOR_DOMAIN, [])
|
||||||
if sensors:
|
if sensors:
|
||||||
@ -100,6 +100,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ScrapeConfigEntry) -> bo
|
|||||||
|
|
||||||
coordinator = ScrapeCoordinator(
|
coordinator = ScrapeCoordinator(
|
||||||
hass,
|
hass,
|
||||||
|
entry,
|
||||||
rest,
|
rest,
|
||||||
DEFAULT_SCAN_INTERVAL,
|
DEFAULT_SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
|
@ -8,6 +8,7 @@ import logging
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
from homeassistant.components.rest import RestData
|
from homeassistant.components.rest import RestData
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
@ -18,12 +19,17 @@ class ScrapeCoordinator(DataUpdateCoordinator[BeautifulSoup]):
|
|||||||
"""Scrape Coordinator."""
|
"""Scrape Coordinator."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, hass: HomeAssistant, rest: RestData, update_interval: timedelta
|
self,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry | None,
|
||||||
|
rest: RestData,
|
||||||
|
update_interval: timedelta,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize Scrape coordinator."""
|
"""Initialize Scrape coordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name="Scrape Coordinator",
|
name="Scrape Coordinator",
|
||||||
update_interval=update_interval,
|
update_interval=update_interval,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user