core/homeassistant/components/starlink/__init__.py

36 lines
1000 B
Python

"""The Starlink integration."""
from __future__ import annotations
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from .coordinator import StarlinkConfigEntry, StarlinkUpdateCoordinator
PLATFORMS = [
Platform.BINARY_SENSOR,
Platform.BUTTON,
Platform.DEVICE_TRACKER,
Platform.SENSOR,
Platform.SWITCH,
Platform.TIME,
]
async def async_setup_entry(
hass: HomeAssistant, config_entry: StarlinkConfigEntry
) -> bool:
"""Set up Starlink from a config entry."""
config_entry.runtime_data = StarlinkUpdateCoordinator(hass, config_entry)
await config_entry.runtime_data.async_config_entry_first_refresh()
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
return True
async def async_unload_entry(
hass: HomeAssistant, config_entry: StarlinkConfigEntry
) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)