Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The PVOutput integration."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.config_entries import ConfigEntry
6 from homeassistant.core import HomeAssistant
7 
8 from .const import DOMAIN, PLATFORMS
9 from .coordinator import PVOutputDataUpdateCoordinator
10 
11 
12 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
13  """Set up PVOutput from a config entry."""
14  coordinator = PVOutputDataUpdateCoordinator(hass, entry)
15  await coordinator.async_config_entry_first_refresh()
16 
17  hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
18  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
19 
20  return True
21 
22 
23 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
24  """Unload PVOutput config entry."""
25  if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
26  del hass.data[DOMAIN][entry.entry_id]
27  return unload_ok
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:23
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:12