mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Explicitly pass in the config_entry in radiotherm coordinator (#137983)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
f30018d89e
commit
a90d471be0
@ -43,7 +43,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
host = entry.data[CONF_HOST]
|
host = entry.data[CONF_HOST]
|
||||||
init_coro = async_get_init_data(hass, host)
|
init_coro = async_get_init_data(hass, host)
|
||||||
init_data = await _async_call_or_raise_not_ready(init_coro, host)
|
init_data = await _async_call_or_raise_not_ready(init_coro, host)
|
||||||
coordinator = RadioThermUpdateCoordinator(hass, init_data)
|
coordinator = RadioThermUpdateCoordinator(hass, entry, init_data)
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
# Only set the time if the thermostat is
|
# Only set the time if the thermostat is
|
||||||
|
@ -8,6 +8,7 @@ from urllib.error import URLError
|
|||||||
|
|
||||||
from radiotherm.validate import RadiothermTstatError
|
from radiotherm.validate import RadiothermTstatError
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
@ -21,13 +22,21 @@ UPDATE_INTERVAL = timedelta(seconds=15)
|
|||||||
class RadioThermUpdateCoordinator(DataUpdateCoordinator[RadioThermUpdate]):
|
class RadioThermUpdateCoordinator(DataUpdateCoordinator[RadioThermUpdate]):
|
||||||
"""DataUpdateCoordinator to gather data for radio thermostats."""
|
"""DataUpdateCoordinator to gather data for radio thermostats."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, init_data: RadioThermInitData) -> None:
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
init_data: RadioThermInitData,
|
||||||
|
) -> None:
|
||||||
"""Initialize DataUpdateCoordinator."""
|
"""Initialize DataUpdateCoordinator."""
|
||||||
self.init_data = init_data
|
self.init_data = init_data
|
||||||
self._description = f"{init_data.name} ({init_data.host})"
|
self._description = f"{init_data.name} ({init_data.host})"
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=f"radiotherm {self.init_data.name}",
|
name=f"radiotherm {self.init_data.name}",
|
||||||
update_interval=UPDATE_INTERVAL,
|
update_interval=UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user