mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 02:37:50 +00:00
Explicitly pass in the config_entry in justnimbus coordinator (#138128)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
b533cd3107
commit
b9828c5edd
@ -13,7 +13,7 @@ from .coordinator import JustNimbusCoordinator
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up JustNimbus from a config entry."""
|
"""Set up JustNimbus from a config entry."""
|
||||||
if "zip_code" in entry.data:
|
if "zip_code" in entry.data:
|
||||||
coordinator = JustNimbusCoordinator(hass=hass, entry=entry)
|
coordinator = JustNimbusCoordinator(hass, entry)
|
||||||
else:
|
else:
|
||||||
raise ConfigEntryAuthFailed
|
raise ConfigEntryAuthFailed
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
@ -20,16 +20,20 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class JustNimbusCoordinator(DataUpdateCoordinator[justnimbus.JustNimbusModel]):
|
class JustNimbusCoordinator(DataUpdateCoordinator[justnimbus.JustNimbusModel]):
|
||||||
"""Data update coordinator."""
|
"""Data update coordinator."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
|
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
||||||
"""Initialize the coordinator."""
|
"""Initialize the coordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name=DOMAIN,
|
name=DOMAIN,
|
||||||
update_interval=timedelta(minutes=1),
|
update_interval=timedelta(minutes=1),
|
||||||
)
|
)
|
||||||
self._client = justnimbus.JustNimbusClient(
|
self._client = justnimbus.JustNimbusClient(
|
||||||
client_id=entry.data[CONF_CLIENT_ID], zip_code=entry.data[CONF_ZIP_CODE]
|
client_id=config_entry.data[CONF_CLIENT_ID],
|
||||||
|
zip_code=config_entry.data[CONF_ZIP_CODE],
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _async_update_data(self) -> justnimbus.JustNimbusModel:
|
async def _async_update_data(self) -> justnimbus.JustNimbusModel:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user