mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Explicitly pass in the config_entry in opengarage coordinator (#138052)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
e050238106
commit
6d776469d2
@ -24,8 +24,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
async_get_clientsession(hass),
|
||||
)
|
||||
open_garage_data_coordinator = OpenGarageDataUpdateCoordinator(
|
||||
hass,
|
||||
open_garage_connection=open_garage_connection,
|
||||
hass, entry, open_garage_connection
|
||||
)
|
||||
await open_garage_data_coordinator.async_config_entry_first_refresh()
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = open_garage_data_coordinator
|
||||
|
@ -8,6 +8,7 @@ from typing import Any
|
||||
|
||||
import opengarage
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import update_coordinator
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
@ -20,10 +21,12 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class OpenGarageDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Class to manage fetching Opengarage data."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
*,
|
||||
config_entry: ConfigEntry,
|
||||
open_garage_connection: opengarage.OpenGarage,
|
||||
) -> None:
|
||||
"""Initialize global Opengarage data updater."""
|
||||
@ -32,6 +35,7 @@ class OpenGarageDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=timedelta(seconds=5),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user