From 0decb0cfba288ad6e16a0b0c010e829a405c3429 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Sun, 9 Feb 2025 21:03:19 +0100 Subject: [PATCH] Explicitly pass in the config_entry in iotawatt coordinator (#138141) explicitly pass in the config_entry in coordinator --- homeassistant/components/iotawatt/coordinator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/iotawatt/coordinator.py b/homeassistant/components/iotawatt/coordinator.py index 4f9ac1f94b7..13802ebdd76 100644 --- a/homeassistant/components/iotawatt/coordinator.py +++ b/homeassistant/components/iotawatt/coordinator.py @@ -26,13 +26,14 @@ class IotawattUpdater(DataUpdateCoordinator): """Class to manage fetching update data from the IoTaWatt Energy Device.""" api: Iotawatt | None = None + config_entry: ConfigEntry def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: """Initialize IotaWattUpdater object.""" - self.entry = entry super().__init__( hass=hass, logger=_LOGGER, + config_entry=entry, name=entry.title, update_interval=timedelta(seconds=30), request_refresh_debouncer=Debouncer( @@ -57,11 +58,11 @@ class IotawattUpdater(DataUpdateCoordinator): """Fetch sensors from IoTaWatt device.""" if self.api is None: api = Iotawatt( - self.entry.title, - self.entry.data[CONF_HOST], + self.config_entry.title, + self.config_entry.data[CONF_HOST], httpx_client.get_async_client(self.hass), - self.entry.data.get(CONF_USERNAME), - self.entry.data.get(CONF_PASSWORD), + self.config_entry.data.get(CONF_USERNAME), + self.config_entry.data.get(CONF_PASSWORD), integratedInterval="d", includeNonTotalSensors=False, )