mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Explicitly pass in the config_entry in squeezebox coordinator (#137934)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
51d3e449ab
commit
1976fdfa55
@ -127,7 +127,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) -
|
||||
)
|
||||
_LOGGER.debug("LMS Device %s", device)
|
||||
|
||||
server_coordinator = LMSStatusDataUpdateCoordinator(hass, lms)
|
||||
server_coordinator = LMSStatusDataUpdateCoordinator(hass, entry, lms)
|
||||
|
||||
entry.runtime_data = SqueezeboxData(
|
||||
coordinator=server_coordinator,
|
||||
|
@ -1,11 +1,13 @@
|
||||
"""DataUpdateCoordinator for the Squeezebox integration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from collections.abc import Callable
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
import re
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from pysqueezebox import Player, Server
|
||||
|
||||
@ -14,6 +16,9 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import SqueezeboxConfigEntry
|
||||
|
||||
from .const import (
|
||||
PLAYER_UPDATE_INTERVAL,
|
||||
SENSOR_UPDATE_INTERVAL,
|
||||
@ -30,11 +35,16 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class LMSStatusDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""LMS Status custom coordinator."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, lms: Server) -> None:
|
||||
config_entry: SqueezeboxConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: SqueezeboxConfigEntry, lms: Server
|
||||
) -> None:
|
||||
"""Initialize my coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=lms.name,
|
||||
update_interval=timedelta(seconds=SENSOR_UPDATE_INTERVAL),
|
||||
always_update=False,
|
||||
|
Loading…
x
Reference in New Issue
Block a user