Explicitly pass in the config_entry in vizio coordinator (#137876)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 00:40:14 +01:00 committed by GitHub
parent 7ec7badef6
commit 54c4ee7838
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -25,7 +25,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
and entry.data[CONF_DEVICE_CLASS] == MediaPlayerDeviceClass.TV
):
store: Store[list[dict[str, Any]]] = Store(hass, 1, DOMAIN)
coordinator = VizioAppsDataUpdateCoordinator(hass, store)
coordinator = VizioAppsDataUpdateCoordinator(hass, entry, store)
await coordinator.async_config_entry_first_refresh()
hass.data[DOMAIN][CONF_APPS] = coordinator

View File

@ -9,6 +9,7 @@ from typing import Any
from pyvizio.const import APPS
from pyvizio.util import gen_apps_list_from_url
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.storage import Store
@ -22,11 +23,19 @@ _LOGGER = logging.getLogger(__name__)
class VizioAppsDataUpdateCoordinator(DataUpdateCoordinator[list[dict[str, Any]]]):
"""Define an object to hold Vizio app config data."""
def __init__(self, hass: HomeAssistant, store: Store[list[dict[str, Any]]]) -> None:
config_entry: ConfigEntry
def __init__(
self,
hass: HomeAssistant,
config_entry: ConfigEntry,
store: Store[list[dict[str, Any]]],
) -> None:
"""Initialize."""
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name=DOMAIN,
update_interval=timedelta(days=1),
)