mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +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:
|
||||
"""Set up JustNimbus from a config entry."""
|
||||
if "zip_code" in entry.data:
|
||||
coordinator = JustNimbusCoordinator(hass=hass, entry=entry)
|
||||
coordinator = JustNimbusCoordinator(hass, entry)
|
||||
else:
|
||||
raise ConfigEntryAuthFailed
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
@ -20,16 +20,20 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class JustNimbusCoordinator(DataUpdateCoordinator[justnimbus.JustNimbusModel]):
|
||||
"""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."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=timedelta(minutes=1),
|
||||
)
|
||||
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user