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-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:
|
|
|
|
hass.async_create_task(hass.config_entries.flow.async_init(
|
2018-08-09 11:24:14 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
async def async_setup_entry(hass, entry):
|
|
|
|
"""Set up Cast from a config entry."""
|
2018-07-23 12:05:38 +00:00
|
|
|
hass.async_create_task(hass.config_entries.async_forward_entry_setup(
|
2018-06-14 19:17:54 +00:00
|
|
|
entry, 'media_player'))
|
|
|
|
return True
|