Explicitly pass in the config_entry in streamlabswater coordinator (#137927)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-08 21:19:38 +01:00 committed by GitHub
parent 43569df537
commit bcc3e6d31c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -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()

View File

@ -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),
)