Explicitly pass in the config_entry in iotawatt coordinator (#138141)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 21:03:19 +01:00 committed by GitHub
parent e7d49823e4
commit 0decb0cfba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,
)