1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-17 23:53:49 +01:00
Files
core/homeassistant/components/intelliclima/__init__.py
dvdinth b7c36c707f Add IntelliClima Sensor platform (#163901)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Norbert Rittel <norbert@rittel.de>
Co-authored-by: Joostlek <joostlek@outlook.com>
2026-03-12 16:33:34 +01:00

52 lines
1.4 KiB
Python

"""The IntelliClima VMC integration."""
from pyintelliclima.api import IntelliClimaAPI
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import LOGGER
from .coordinator import IntelliClimaConfigEntry, IntelliClimaCoordinator
PLATFORMS = [Platform.FAN, Platform.SELECT, Platform.SENSOR]
async def async_setup_entry(
hass: HomeAssistant, entry: IntelliClimaConfigEntry
) -> bool:
"""Set up IntelliClima VMC from a config entry."""
# Create API client
session = async_get_clientsession(hass)
api = IntelliClimaAPI(
session,
entry.data[CONF_USERNAME],
entry.data[CONF_PASSWORD],
)
# Create coordinator
coordinator = IntelliClimaCoordinator(hass, entry, api)
# Fetch initial data
await coordinator.async_config_entry_first_refresh()
LOGGER.debug(
"Discovered %d IntelliClima VMC device(s)",
len(coordinator.data.ecocomfort2_devices),
)
# Store coordinator
entry.runtime_data = coordinator
# Set up platforms
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(
hass: HomeAssistant, entry: IntelliClimaConfigEntry
) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)