Pass config_entry explicitly in rachio (#130865)

pull/114941/head^2
epenet 2024-11-18 14:19:40 +01:00 committed by GitHub
parent db5cc4fcd4
commit 1ac0b006b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,7 @@ from typing import Any
from rachiopy import Rachio
from requests.exceptions import Timeout
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.debounce import Debouncer
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
@ -38,6 +39,7 @@ class RachioUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
self,
hass: HomeAssistant,
rachio: Rachio,
config_entry: ConfigEntry,
base_station,
base_count: int,
) -> None:
@ -48,6 +50,7 @@ class RachioUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name=f"{DOMAIN} update coordinator",
# To avoid exceeding the rate limit, increase polling interval for
# each additional base station on the account
@ -76,6 +79,7 @@ class RachioScheduleUpdateCoordinator(DataUpdateCoordinator[list[dict[str, Any]]
self,
hass: HomeAssistant,
rachio: Rachio,
config_entry: ConfigEntry,
base_station,
) -> None:
"""Initialize a Rachio schedule coordinator."""
@ -85,6 +89,7 @@ class RachioScheduleUpdateCoordinator(DataUpdateCoordinator[list[dict[str, Any]]
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name=f"{DOMAIN} schedule update coordinator",
update_interval=timedelta(minutes=30),
)

View File

@ -189,8 +189,10 @@ class RachioPerson:
RachioBaseStation(
rachio,
base,
RachioUpdateCoordinator(hass, rachio, base, base_count),
RachioScheduleUpdateCoordinator(hass, rachio, base),
RachioUpdateCoordinator(
hass, rachio, self.config_entry, base, base_count
),
RachioScheduleUpdateCoordinator(hass, rachio, self.config_entry, base),
)
for base in base_stations
)