2021-05-05 23:41:32 +00:00
|
|
|
"""Support for Elgato Lights."""
|
2024-03-08 13:15:26 +00:00
|
|
|
|
2019-12-08 08:26:31 +00:00
|
|
|
from homeassistant.config_entries import ConfigEntry
|
2023-02-05 20:54:30 +00:00
|
|
|
from homeassistant.const import Platform
|
2019-12-08 08:26:31 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
2023-02-05 20:54:30 +00:00
|
|
|
from .coordinator import ElgatoDataUpdateCoordinator
|
2019-12-08 08:26:31 +00:00
|
|
|
|
2023-02-08 10:42:53 +00:00
|
|
|
PLATFORMS = [Platform.BUTTON, Platform.LIGHT, Platform.SENSOR, Platform.SWITCH]
|
2021-04-27 06:46:49 +00:00
|
|
|
|
2024-05-17 13:42:58 +00:00
|
|
|
type ElgatorConfigEntry = ConfigEntry[ElgatoDataUpdateCoordinator]
|
2019-12-08 08:26:31 +00:00
|
|
|
|
2024-05-06 17:12:01 +00:00
|
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ElgatorConfigEntry) -> bool:
|
2021-05-05 23:41:32 +00:00
|
|
|
"""Set up Elgato Light from a config entry."""
|
2023-02-05 20:54:30 +00:00
|
|
|
coordinator = ElgatoDataUpdateCoordinator(hass, entry)
|
2022-01-21 18:38:02 +00:00
|
|
|
await coordinator.async_config_entry_first_refresh()
|
2019-12-08 08:26:31 +00:00
|
|
|
|
2024-05-06 17:12:01 +00:00
|
|
|
entry.runtime_data = coordinator
|
2022-07-09 15:27:42 +00:00
|
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
2019-12-08 08:26:31 +00:00
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2024-05-06 17:12:01 +00:00
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ElgatorConfigEntry) -> bool:
|
2021-05-05 23:41:32 +00:00
|
|
|
"""Unload Elgato Light config entry."""
|
2024-05-06 17:12:01 +00:00
|
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|