1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-31 12:44:04 +01:00
Files
core/homeassistant/components/indevolt/__init__.py
T
Franck Nijhof b9575ee881 Fix line length violations in components i-l (#170704)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2026-05-14 23:24:13 +02:00

50 lines
1.4 KiB
Python

"""Home Assistant integration for indevolt device."""
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN
from .coordinator import IndevoltConfigEntry, IndevoltCoordinator
from .services import async_setup_services
PLATFORMS: list[Platform] = [
Platform.BINARY_SENSOR,
Platform.BUTTON,
Platform.NUMBER,
Platform.SELECT,
Platform.SENSOR,
Platform.SWITCH,
]
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
async def async_setup_entry(hass: HomeAssistant, entry: IndevoltConfigEntry) -> bool:
"""Set up indevolt integration entry using given configuration."""
coordinator = IndevoltCoordinator(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_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up indevolt services (actions)."""
await async_setup_services(hass)
return True
async def async_unload_entry(hass: HomeAssistant, entry: IndevoltConfigEntry) -> bool:
"""Unload a config entry.
Clean up resources when integration is removed or reloaded.
"""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)