Set config_entry explicitely in scrape coordinator (#129416)

This commit is contained in:
epenet 2024-10-29 14:54:24 +01:00 committed by GitHub
parent 02928601ef
commit 10fdf819d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -72,7 +72,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
scan_interval: timedelta = resource_config.get(
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, [])
if sensors:
@ -100,6 +100,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ScrapeConfigEntry) -> bo
coordinator = ScrapeCoordinator(
hass,
entry,
rest,
DEFAULT_SCAN_INTERVAL,
)

View File

@ -8,6 +8,7 @@ import logging
from bs4 import BeautifulSoup
from homeassistant.components.rest import RestData
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
@ -18,12 +19,17 @@ class ScrapeCoordinator(DataUpdateCoordinator[BeautifulSoup]):
"""Scrape Coordinator."""
def __init__(
self, hass: HomeAssistant, rest: RestData, update_interval: timedelta
self,
hass: HomeAssistant,
config_entry: ConfigEntry | None,
rest: RestData,
update_interval: timedelta,
) -> None:
"""Initialize Scrape coordinator."""
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name="Scrape Coordinator",
update_interval=update_interval,
)