Explicitly pass in the config_entry in landisgyr_heat_meter coordinator (#138119)

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

View File

@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
reader = ultraheat_api.UltraheatReader(entry.data[CONF_DEVICE])
api = ultraheat_api.HeatMeterService(reader)
coordinator = UltraheatCoordinator(hass, api)
coordinator = UltraheatCoordinator(hass, entry, api)
await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator

View File

@ -7,6 +7,7 @@ import serial
from ultraheat_api.response import HeatMeterResponse
from ultraheat_api.service import HeatMeterService
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
@ -18,11 +19,16 @@ _LOGGER = logging.getLogger(__name__)
class UltraheatCoordinator(DataUpdateCoordinator[HeatMeterResponse]):
"""Coordinator for getting data from the ultraheat api."""
def __init__(self, hass: HomeAssistant, api: HeatMeterService) -> None:
config_entry: ConfigEntry
def __init__(
self, hass: HomeAssistant, config_entry: ConfigEntry, api: HeatMeterService
) -> None:
"""Initialize my coordinator."""
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name="ultraheat",
update_interval=POLLING_INTERVAL,
)