1 """The Homewizard integration."""
7 from .const
import DOMAIN, PLATFORMS
8 from .coordinator
import HWEnergyDeviceUpdateCoordinator
10 type HomeWizardConfigEntry = ConfigEntry[HWEnergyDeviceUpdateCoordinator]
14 """Set up Homewizard from a config entry."""
17 await coordinator.async_config_entry_first_refresh()
19 except ConfigEntryNotReady:
20 await coordinator.api.close()
22 if coordinator.api_disabled:
23 entry.async_start_reauth(hass)
27 entry.runtime_data = coordinator
30 for progress_flow
in hass.config_entries.flow.async_progress_by_handler(DOMAIN):
32 "context" in progress_flow
33 and progress_flow[
"context"].
get(
"source") == SOURCE_REAUTH
35 hass.config_entries.flow.async_abort(progress_flow[
"flow_id"])
38 entry.async_on_unload(coordinator.api.close)
39 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
45 """Unload a config entry."""
46 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
web.Response get(self, web.Request request, str config_key)
bool async_setup_entry(HomeAssistant hass, HomeWizardConfigEntry entry)
bool async_unload_entry(HomeAssistant hass, HomeWizardConfigEntry entry)