mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Explicitly pass in the config_entry in streamlabswater coordinator (#137927)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
43569df537
commit
bcc3e6d31c
@ -35,7 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
api_key = entry.data[CONF_API_KEY]
|
||||
client = StreamlabsClient(api_key)
|
||||
coordinator = StreamlabsCoordinator(hass, client)
|
||||
coordinator = StreamlabsCoordinator(hass, entry, client)
|
||||
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
|
@ -5,6 +5,7 @@ from datetime import timedelta
|
||||
|
||||
from streamlabswater.streamlabswater import StreamlabsClient
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
@ -25,15 +26,19 @@ class StreamlabsData:
|
||||
class StreamlabsCoordinator(DataUpdateCoordinator[dict[str, StreamlabsData]]):
|
||||
"""Coordinator for Streamlabs."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
client: StreamlabsClient,
|
||||
) -> None:
|
||||
"""Coordinator for Streamlabs."""
|
||||
super().__init__(
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name="Streamlabs",
|
||||
update_interval=timedelta(seconds=60),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user