From 9e7f8b7bffe5a11c715e45b5afae31457f405f73 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Sun, 9 Feb 2025 20:08:59 +0100 Subject: [PATCH] Explicitly pass in the config_entry in landisgyr_heat_meter coordinator (#138119) explicitly pass in the config_entry in coordinator --- homeassistant/components/landisgyr_heat_meter/__init__.py | 2 +- .../components/landisgyr_heat_meter/coordinator.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/landisgyr_heat_meter/__init__.py b/homeassistant/components/landisgyr_heat_meter/__init__.py index 5cbdc593100..7e7ebe61eb7 100644 --- a/homeassistant/components/landisgyr_heat_meter/__init__.py +++ b/homeassistant/components/landisgyr_heat_meter/__init__.py @@ -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 diff --git a/homeassistant/components/landisgyr_heat_meter/coordinator.py b/homeassistant/components/landisgyr_heat_meter/coordinator.py index db265449f37..4214fa1db3e 100644 --- a/homeassistant/components/landisgyr_heat_meter/coordinator.py +++ b/homeassistant/components/landisgyr_heat_meter/coordinator.py @@ -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, ) -- GitLab