mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Explicitly pass in the config_entry in melnor coordinator (#138092)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
c8f035b5c5
commit
af8efadd1b
@ -57,7 +57,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
bluetooth.BluetoothScanningMode.PASSIVE,
|
||||
)
|
||||
|
||||
coordinator = MelnorDataUpdateCoordinator(hass, device)
|
||||
coordinator = MelnorDataUpdateCoordinator(hass, entry, device)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
hass.data[DOMAIN][entry.entry_id] = coordinator
|
||||
|
@ -5,6 +5,7 @@ import logging
|
||||
|
||||
from melnor_bluetooth.device import Device
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
@ -14,13 +15,17 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class MelnorDataUpdateCoordinator(DataUpdateCoordinator[Device]):
|
||||
"""Melnor data update coordinator."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
_device: Device
|
||||
|
||||
def __init__(self, hass: HomeAssistant, device: Device) -> None:
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry, device: Device
|
||||
) -> None:
|
||||
"""Initialize my coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name="Melnor Bluetooth",
|
||||
update_interval=timedelta(seconds=5),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user