Skip to content

Commit

Permalink
Set config_entry explicitely in scrape coordinator (home-assistant#12…
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Oct 29, 2024
1 parent 0292860 commit 10fdf81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion homeassistant/components/scrape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -100,6 +100,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ScrapeConfigEntry) -> bo

coordinator = ScrapeCoordinator(
hass,
entry,
rest,
DEFAULT_SCAN_INTERVAL,
)
Expand Down
8 changes: 7 additions & 1 deletion homeassistant/components/scrape/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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

Expand All @@ -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,
)
Expand Down

0 comments on commit 10fdf81

Please sign in to comment.