mirror of
https://github.com/home-assistant/core.git
synced 2026-05-21 16:00:12 +01:00
7da5b10b51
Co-authored-by: bryan <185078974@qq.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
26 lines
926 B
Python
26 lines
926 B
Python
"""The aidot integration."""
|
|
|
|
from homeassistant.const import Platform
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .coordinator import AidotConfigEntry, AidotDeviceManagerCoordinator
|
|
|
|
PLATFORMS: list[Platform] = [Platform.LIGHT]
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: AidotConfigEntry) -> bool:
|
|
"""Set up aidot from a config entry."""
|
|
|
|
coordinator = AidotDeviceManagerCoordinator(hass, entry)
|
|
await coordinator.async_config_entry_first_refresh()
|
|
entry.runtime_data = coordinator
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
|
entry.async_on_unload(coordinator.async_add_listener(lambda: None))
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: AidotConfigEntry) -> bool:
|
|
"""Unload a config entry."""
|
|
await entry.runtime_data.async_cleanup()
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|