mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""The OMIE - Spain and Portugal electricity prices integration."""
|
|
|
|
from homeassistant.const import Platform
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers import config_validation as cv
|
|
from homeassistant.helpers.typing import ConfigType
|
|
|
|
from .const import DOMAIN
|
|
from .coordinator import OMIEConfigEntry, OMIECoordinator
|
|
from .services import async_setup_services
|
|
|
|
PLATFORMS = [Platform.SENSOR]
|
|
|
|
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
|
|
|
|
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|
"""Set up the OMIE integration."""
|
|
async_setup_services(hass)
|
|
return True
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: OMIEConfigEntry) -> bool:
|
|
"""Set up from a config entry."""
|
|
entry.runtime_data = OMIECoordinator(hass, entry)
|
|
|
|
await entry.runtime_data.async_config_entry_first_refresh()
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: OMIEConfigEntry) -> bool:
|
|
"""Unload a config entry."""
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|