Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """Initialize the Acaia component."""
2 
3 from homeassistant.const import Platform
4 from homeassistant.core import HomeAssistant
5 
6 from .coordinator import AcaiaConfigEntry, AcaiaCoordinator
7 
8 PLATFORMS = [
9  Platform.BINARY_SENSOR,
10  Platform.BUTTON,
11  Platform.SENSOR,
12 ]
13 
14 
15 async def async_setup_entry(hass: HomeAssistant, entry: AcaiaConfigEntry) -> bool:
16  """Set up acaia as config entry."""
17 
18  coordinator = AcaiaCoordinator(hass, entry)
19  await coordinator.async_config_entry_first_refresh()
20 
21  entry.runtime_data = coordinator
22 
23  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
24 
25  return True
26 
27 
28 async def async_unload_entry(hass: HomeAssistant, entry: AcaiaConfigEntry) -> bool:
29  """Unload a config entry."""
30 
31  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, AcaiaConfigEntry entry)
Definition: __init__.py:28
bool async_setup_entry(HomeAssistant hass, AcaiaConfigEntry entry)
Definition: __init__.py:15