mirror of
https://github.com/home-assistant/core.git
synced 2026-05-30 04:05:01 +01:00
d766aae436
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
"""Home Assistant Prana integration entry point.
|
|
|
|
Sets up the update coordinator and forwards platform setups.
|
|
"""
|
|
|
|
import logging
|
|
|
|
from homeassistant.const import Platform
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .coordinator import PranaConfigEntry, PranaCoordinator
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
PLATFORMS = [Platform.FAN, Platform.NUMBER, Platform.SENSOR, Platform.SWITCH]
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: PranaConfigEntry) -> bool:
|
|
"""Set up Prana from a config entry."""
|
|
coordinator = PranaCoordinator(hass, entry)
|
|
await coordinator.async_config_entry_first_refresh()
|
|
entry.runtime_data = coordinator
|
|
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: PranaConfigEntry) -> bool:
|
|
"""Unload Prana integration platforms and coordinator."""
|
|
_LOGGER.info("Unloading Prana integration")
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|