2018-06-14 19:17:54 +00:00
|
|
|
"""Component to embed Google Cast."""
|
2018-08-09 11:24:14 +00:00
|
|
|
from homeassistant import config_entries
|
2018-06-14 19:17:54 +00:00
|
|
|
|
2019-09-11 18:34:10 +00:00
|
|
|
from . import home_assistant_cast
|
2019-05-13 08:16:55 +00:00
|
|
|
from .const import DOMAIN
|
2018-06-14 19:17:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def async_setup(hass, config):
|
|
|
|
"""Set up the Cast component."""
|
2018-07-23 13:08:03 +00:00
|
|
|
conf = config.get(DOMAIN)
|
|
|
|
|
|
|
|
hass.data[DOMAIN] = conf or {}
|
|
|
|
|
|
|
|
if conf is not None:
|
2019-07-31 19:25:30 +00:00
|
|
|
hass.async_create_task(
|
|
|
|
hass.config_entries.flow.async_init(
|
|
|
|
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}
|
|
|
|
)
|
|
|
|
)
|
2018-07-23 13:08:03 +00:00
|
|
|
|
2018-06-14 19:17:54 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
2019-09-11 18:34:10 +00:00
|
|
|
async def async_setup_entry(hass, entry: config_entries.ConfigEntry):
|
2018-06-14 19:17:54 +00:00
|
|
|
"""Set up Cast from a config entry."""
|
2019-09-11 18:34:10 +00:00
|
|
|
await home_assistant_cast.async_setup_ha_cast(hass, entry)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
hass.async_create_task(
|
|
|
|
hass.config_entries.async_forward_entry_setup(entry, "media_player")
|
|
|
|
)
|
2018-06-14 19:17:54 +00:00
|
|
|
return True
|