Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The ATAG Integration."""
2 
3 from homeassistant.const import Platform
4 from homeassistant.core import HomeAssistant
5 
6 from .coordinator import AtagConfigEntry, AtagDataUpdateCoordinator
7 
8 DOMAIN = "atag"
9 PLATFORMS = [Platform.CLIMATE, Platform.SENSOR, Platform.WATER_HEATER]
10 
11 
12 async def async_setup_entry(hass: HomeAssistant, entry: AtagConfigEntry) -> bool:
13  """Set up Atag integration from a config entry."""
14 
15  coordinator = AtagDataUpdateCoordinator(hass, entry)
16  await coordinator.async_config_entry_first_refresh()
17 
18  entry.runtime_data = coordinator
19  if entry.unique_id is None:
20  hass.config_entries.async_update_entry(entry, unique_id=coordinator.atag.id)
21 
22  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
23 
24  return True
25 
26 
27 async def async_unload_entry(hass: HomeAssistant, entry: AtagConfigEntry) -> bool:
28  """Unload Atag config entry."""
29  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, AtagConfigEntry entry)
Definition: __init__.py:27
bool async_setup_entry(HomeAssistant hass, AtagConfigEntry entry)
Definition: __init__.py:12