mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Explicitly pass in the config_entry in iotawatt coordinator (#138141)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
e7d49823e4
commit
0decb0cfba
@ -26,13 +26,14 @@ class IotawattUpdater(DataUpdateCoordinator):
|
|||||||
"""Class to manage fetching update data from the IoTaWatt Energy Device."""
|
"""Class to manage fetching update data from the IoTaWatt Energy Device."""
|
||||||
|
|
||||||
api: Iotawatt | None = None
|
api: Iotawatt | None = None
|
||||||
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Initialize IotaWattUpdater object."""
|
"""Initialize IotaWattUpdater object."""
|
||||||
self.entry = entry
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass=hass,
|
hass=hass,
|
||||||
logger=_LOGGER,
|
logger=_LOGGER,
|
||||||
|
config_entry=entry,
|
||||||
name=entry.title,
|
name=entry.title,
|
||||||
update_interval=timedelta(seconds=30),
|
update_interval=timedelta(seconds=30),
|
||||||
request_refresh_debouncer=Debouncer(
|
request_refresh_debouncer=Debouncer(
|
||||||
@ -57,11 +58,11 @@ class IotawattUpdater(DataUpdateCoordinator):
|
|||||||
"""Fetch sensors from IoTaWatt device."""
|
"""Fetch sensors from IoTaWatt device."""
|
||||||
if self.api is None:
|
if self.api is None:
|
||||||
api = Iotawatt(
|
api = Iotawatt(
|
||||||
self.entry.title,
|
self.config_entry.title,
|
||||||
self.entry.data[CONF_HOST],
|
self.config_entry.data[CONF_HOST],
|
||||||
httpx_client.get_async_client(self.hass),
|
httpx_client.get_async_client(self.hass),
|
||||||
self.entry.data.get(CONF_USERNAME),
|
self.config_entry.data.get(CONF_USERNAME),
|
||||||
self.entry.data.get(CONF_PASSWORD),
|
self.config_entry.data.get(CONF_PASSWORD),
|
||||||
integratedInterval="d",
|
integratedInterval="d",
|
||||||
includeNonTotalSensors=False,
|
includeNonTotalSensors=False,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user