mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Explicitly pass in the config_entry in vallox coordinator (#137881)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
e092937c00
commit
0cbec3c4bb
@ -111,7 +111,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
client = Vallox(host)
|
||||
|
||||
coordinator = ValloxDataUpdateCoordinator(hass, name, client)
|
||||
coordinator = ValloxDataUpdateCoordinator(hass, entry, client)
|
||||
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
|
@ -6,6 +6,8 @@ import logging
|
||||
|
||||
from vallox_websocket_api import MetricData, Vallox, ValloxApiException
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
@ -17,17 +19,20 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class ValloxDataUpdateCoordinator(DataUpdateCoordinator[MetricData]):
|
||||
"""The DataUpdateCoordinator for Vallox."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
name: str,
|
||||
config_entry: ConfigEntry,
|
||||
client: Vallox,
|
||||
) -> None:
|
||||
"""Initialize Vallox data coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
name=f"{name} DataUpdateCoordinator",
|
||||
config_entry=config_entry,
|
||||
name=f"{config_entry.data[CONF_NAME]} DataUpdateCoordinator",
|
||||
update_interval=STATE_SCAN_INTERVAL,
|
||||
)
|
||||
self.client = client
|
||||
|
Loading…
x
Reference in New Issue
Block a user