mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +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)
|
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()
|
await coord_data.async_config_entry_first_refresh()
|
||||||
|
|
||||||
coord_fw = QswFirmwareCoordinator(hass, qsw)
|
coord_fw = QswFirmwareCoordinator(hass, entry, qsw)
|
||||||
try:
|
try:
|
||||||
await coord_fw.async_config_entry_first_refresh()
|
await coord_fw.async_config_entry_first_refresh()
|
||||||
except ConfigEntryNotReady as error:
|
except ConfigEntryNotReady as error:
|
||||||
|
@ -10,6 +10,7 @@ from typing import Any
|
|||||||
from aioqsw.exceptions import QswError
|
from aioqsw.exceptions import QswError
|
||||||
from aioqsw.localapi import QnapQswApi
|
from aioqsw.localapi import QnapQswApi
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
@ -24,13 +25,18 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class QswDataCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
class QswDataCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||||
"""Class to manage fetching data from the QNAP QSW device."""
|
"""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."""
|
"""Initialize."""
|
||||||
self.qsw = qsw
|
self.qsw = qsw
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=DOMAIN,
|
name=DOMAIN,
|
||||||
update_interval=DATA_SCAN_INTERVAL,
|
update_interval=DATA_SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
@ -48,13 +54,18 @@ class QswDataCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
|||||||
class QswFirmwareCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
class QswFirmwareCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||||
"""Class to manage fetching firmware data from the QNAP QSW device."""
|
"""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."""
|
"""Initialize."""
|
||||||
self.qsw = qsw
|
self.qsw = qsw
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=DOMAIN,
|
name=DOMAIN,
|
||||||
update_interval=FW_SCAN_INTERVAL,
|
update_interval=FW_SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user