Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """Support for Elgato Lights."""
2 
3 from homeassistant.config_entries import ConfigEntry
4 from homeassistant.const import Platform
5 from homeassistant.core import HomeAssistant
6 
7 from .coordinator import ElgatoDataUpdateCoordinator
8 
9 PLATFORMS = [Platform.BUTTON, Platform.LIGHT, Platform.SENSOR, Platform.SWITCH]
10 
11 type ElgatorConfigEntry = ConfigEntry[ElgatoDataUpdateCoordinator]
12 
13 
14 async def async_setup_entry(hass: HomeAssistant, entry: ElgatorConfigEntry) -> bool:
15  """Set up Elgato Light from a config entry."""
16  coordinator = ElgatoDataUpdateCoordinator(hass, entry)
17  await coordinator.async_config_entry_first_refresh()
18 
19  entry.runtime_data = coordinator
20  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
21 
22  return True
23 
24 
25 async def async_unload_entry(hass: HomeAssistant, entry: ElgatorConfigEntry) -> bool:
26  """Unload Elgato Light config entry."""
27  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup_entry(HomeAssistant hass, ElgatorConfigEntry entry)
Definition: __init__.py:14
bool async_unload_entry(HomeAssistant hass, ElgatorConfigEntry entry)
Definition: __init__.py:25