mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
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:
parent
b9fd5d01dd
commit
9e7f8b7bff
@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
reader = ultraheat_api.UltraheatReader(entry.data[CONF_DEVICE])
|
reader = ultraheat_api.UltraheatReader(entry.data[CONF_DEVICE])
|
||||||
api = ultraheat_api.HeatMeterService(reader)
|
api = ultraheat_api.HeatMeterService(reader)
|
||||||
|
|
||||||
coordinator = UltraheatCoordinator(hass, api)
|
coordinator = UltraheatCoordinator(hass, entry, api)
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||||
|
@ -7,6 +7,7 @@ import serial
|
|||||||
from ultraheat_api.response import HeatMeterResponse
|
from ultraheat_api.response import HeatMeterResponse
|
||||||
from ultraheat_api.service import HeatMeterService
|
from ultraheat_api.service import HeatMeterService
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
@ -18,11 +19,16 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class UltraheatCoordinator(DataUpdateCoordinator[HeatMeterResponse]):
|
class UltraheatCoordinator(DataUpdateCoordinator[HeatMeterResponse]):
|
||||||
"""Coordinator for getting data from the ultraheat api."""
|
"""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."""
|
"""Initialize my coordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name="ultraheat",
|
name="ultraheat",
|
||||||
update_interval=POLLING_INTERVAL,
|
update_interval=POLLING_INTERVAL,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user