mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Explicitly pass in the config_entry in enphase flexit_bacnet coordinator (#137814)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
fae2c94c74
commit
9e8f2e81bd
@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_DEVICE_ID, Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -21,9 +21,7 @@ PLATFORMS: list[Platform] = [
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Flexit Nordic (BACnet) from a config entry."""
|
"""Set up Flexit Nordic (BACnet) from a config entry."""
|
||||||
|
|
||||||
device_id = entry.data[CONF_DEVICE_ID]
|
coordinator = FlexitCoordinator(hass, entry)
|
||||||
|
|
||||||
coordinator = FlexitCoordinator(hass, device_id)
|
|
||||||
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
|
||||||
|
@ -23,12 +23,13 @@ class FlexitCoordinator(DataUpdateCoordinator[FlexitBACnet]):
|
|||||||
|
|
||||||
config_entry: ConfigEntry
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, device_id: str) -> None:
|
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
||||||
"""Initialize my coordinator."""
|
"""Initialize my coordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
name=f"{DOMAIN}_{device_id}",
|
config_entry=config_entry,
|
||||||
|
name=f"{DOMAIN}_{config_entry.data[CONF_DEVICE_ID]}",
|
||||||
update_interval=timedelta(seconds=60),
|
update_interval=timedelta(seconds=60),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user