"""The solaredge integration.""" from __future__ import annotations from typing import Any import voluptuous as vol from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import CONF_API_KEY, CONF_NAME from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from .const import CONF_SITE_ID, DEFAULT_NAME, DOMAIN CONFIG_SCHEMA = vol.Schema( vol.All( cv.deprecated(DOMAIN), { DOMAIN: vol.Schema( { vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, vol.Required(CONF_API_KEY): cv.string, vol.Required(CONF_SITE_ID): cv.string, } ) }, ), extra=vol.ALLOW_EXTRA, ) async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool: """Platform setup, do nothing.""" if DOMAIN not in config: return True hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=dict(config[DOMAIN]) ) ) return True async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Load the saved entities.""" hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, "sensor") ) return True