mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Explicitly pass in the config_entry in qnap_qsw coordinator (#138027)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
0baa6b3668
commit
4c331d3942
@ -35,10 +35,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
qsw = QnapQswApi(aiohttp_client.async_get_clientsession(hass), options)
|
||||
|
||||
coord_data = QswDataCoordinator(hass, qsw)
|
||||
coord_data = QswDataCoordinator(hass, entry, qsw)
|
||||
await coord_data.async_config_entry_first_refresh()
|
||||
|
||||
coord_fw = QswFirmwareCoordinator(hass, qsw)
|
||||
coord_fw = QswFirmwareCoordinator(hass, entry, qsw)
|
||||
try:
|
||||
await coord_fw.async_config_entry_first_refresh()
|
||||
except ConfigEntryNotReady as error:
|
||||
|
@ -10,6 +10,7 @@ from typing import Any
|
||||
from aioqsw.exceptions import QswError
|
||||
from aioqsw.localapi import QnapQswApi
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
@ -24,13 +25,18 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class QswDataCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Class to manage fetching data from the QNAP QSW device."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, qsw: QnapQswApi) -> None:
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry, qsw: QnapQswApi
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
self.qsw = qsw
|
||||
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=DATA_SCAN_INTERVAL,
|
||||
)
|
||||
@ -48,13 +54,18 @@ class QswDataCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
class QswFirmwareCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Class to manage fetching firmware data from the QNAP QSW device."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, qsw: QnapQswApi) -> None:
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry, qsw: QnapQswApi
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
self.qsw = qsw
|
||||
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=FW_SCAN_INTERVAL,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user