1 """The songpal component."""
3 import voluptuous
as vol
11 from .const
import CONF_ENDPOINT, DOMAIN
13 SONGPAL_CONFIG_SCHEMA = vol.Schema(
14 {vol.Optional(CONF_NAME): cv.string, vol.Required(CONF_ENDPOINT): cv.string}
17 CONFIG_SCHEMA = vol.Schema(
18 {vol.Optional(DOMAIN): vol.All(cv.ensure_list, [SONGPAL_CONFIG_SCHEMA])},
19 extra=vol.ALLOW_EXTRA,
22 PLATFORMS = [Platform.MEDIA_PLAYER]
25 async
def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
26 """Set up songpal environment."""
27 if (conf := config.get(DOMAIN))
is None:
29 for config_entry
in conf:
30 hass.async_create_task(
31 hass.config_entries.flow.async_init(
33 context={
"source": SOURCE_IMPORT},
41 """Set up songpal media player."""
42 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
47 """Unload songpal media player."""
48 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup(HomeAssistant hass, ConfigType config)