1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-30 04:05:01 +01:00
Files
2026-04-30 21:14:48 +02:00

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)