Explicitly pass in the config_entry in husqvarna_automower_ble coordinator (#138150)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 21:08:49 +01:00 committed by GitHub
parent 1dbd23eae1
commit 8c27a75d6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -45,7 +45,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
model = await mower.get_model()
LOGGER.debug("Connected to Automower: %s", model)
coordinator = HusqvarnaCoordinator(hass, mower, address, channel_id, model)
coordinator = HusqvarnaCoordinator(hass, entry, mower, address, channel_id, model)
await coordinator.async_config_entry_first_refresh()
entry.runtime_data = coordinator

View File

@ -9,6 +9,7 @@ from bleak import BleakError
from bleak_retry_connector import close_stale_connections_by_address
from homeassistant.components import bluetooth
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
@ -20,9 +21,12 @@ SCAN_INTERVAL = timedelta(seconds=60)
class HusqvarnaCoordinator(DataUpdateCoordinator[dict[str, bytes]]):
"""Class to manage fetching data."""
config_entry: ConfigEntry
def __init__(
self,
hass: HomeAssistant,
config_entry: ConfigEntry,
mower: Mower,
address: str,
channel_id: str,
@ -32,6 +36,7 @@ class HusqvarnaCoordinator(DataUpdateCoordinator[dict[str, bytes]]):
super().__init__(
hass=hass,
logger=LOGGER,
config_entry=config_entry,
name=DOMAIN,
update_interval=SCAN_INTERVAL,
)