mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
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:
parent
1dbd23eae1
commit
8c27a75d6b
@ -45,7 +45,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
model = await mower.get_model()
|
model = await mower.get_model()
|
||||||
LOGGER.debug("Connected to Automower: %s", 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()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
@ -9,6 +9,7 @@ from bleak import BleakError
|
|||||||
from bleak_retry_connector import close_stale_connections_by_address
|
from bleak_retry_connector import close_stale_connections_by_address
|
||||||
|
|
||||||
from homeassistant.components import bluetooth
|
from homeassistant.components import bluetooth
|
||||||
|
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
|
||||||
|
|
||||||
@ -20,9 +21,12 @@ SCAN_INTERVAL = timedelta(seconds=60)
|
|||||||
class HusqvarnaCoordinator(DataUpdateCoordinator[dict[str, bytes]]):
|
class HusqvarnaCoordinator(DataUpdateCoordinator[dict[str, bytes]]):
|
||||||
"""Class to manage fetching data."""
|
"""Class to manage fetching data."""
|
||||||
|
|
||||||
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
mower: Mower,
|
mower: Mower,
|
||||||
address: str,
|
address: str,
|
||||||
channel_id: str,
|
channel_id: str,
|
||||||
@ -32,6 +36,7 @@ class HusqvarnaCoordinator(DataUpdateCoordinator[dict[str, bytes]]):
|
|||||||
super().__init__(
|
super().__init__(
|
||||||
hass=hass,
|
hass=hass,
|
||||||
logger=LOGGER,
|
logger=LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=DOMAIN,
|
name=DOMAIN,
|
||||||
update_interval=SCAN_INTERVAL,
|
update_interval=SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user