mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Explicitly pass in the config_entry in renson coordinator (#137974)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
7b42dc5c35
commit
8afc3568fb
@ -37,7 +37,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Renson from a config entry."""
|
||||
|
||||
api = RensonVentilation(entry.data[CONF_HOST])
|
||||
coordinator = RensonCoordinator("Renson", hass, api)
|
||||
coordinator = RensonCoordinator(hass, entry, api)
|
||||
|
||||
if not await hass.async_add_executor_job(api.connect):
|
||||
raise ConfigEntryNotReady("Cannot connect to Renson device")
|
||||
|
@ -9,30 +9,35 @@ from typing import Any
|
||||
|
||||
from renson_endura_delta.renson import RensonVentilation
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RensonCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Data update coordinator for Renson."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
api: RensonVentilation,
|
||||
update_interval=timedelta(seconds=30),
|
||||
) -> None:
|
||||
"""Initialize my coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
# Name of the data. For logging purposes.
|
||||
name=name,
|
||||
name=DOMAIN,
|
||||
# Polling interval. Will only be polled if there are subscribers.
|
||||
update_interval=update_interval,
|
||||
update_interval=timedelta(seconds=30),
|
||||
)
|
||||
self.api = api
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user