Beispiel #1
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the DuneHD media player platform."""

    sources = config.get(CONF_SOURCES, {})
    host = config.get(CONF_HOST)
    name = config.get(CONF_NAME)

    add_entities([DuneHDPlayerEntity(DuneHDPlayer(host), name, sources)], True)
Beispiel #2
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the media player demo platform."""
    sources = config.get(CONF_SOURCES, {})

    from pdunehd import DuneHDPlayer
    add_devices([
        DuneHDPlayerEntity(DuneHDPlayer(config[CONF_HOST]), config[CONF_NAME],
                           sources)
    ])
Beispiel #3
0
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Set up a config entry."""
    host: str = entry.data[CONF_HOST]

    player = DuneHDPlayer(host)

    hass.data.setdefault(DOMAIN, {})
    hass.data[DOMAIN][entry.entry_id] = player

    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

    return True
Beispiel #4
0
async def async_setup_entry(hass, entry):
    """Set up a config entry."""
    host = entry.data[CONF_HOST]

    player = DuneHDPlayer(host)

    hass.data.setdefault(DOMAIN, {})
    hass.data[DOMAIN][entry.entry_id] = player

    hass.config_entries.async_setup_platforms(entry, PLATFORMS)

    return True
Beispiel #5
0
async def async_setup_entry(opp: OpenPeerPower, entry: ConfigEntry) -> bool:
    """Set up a config entry."""
    host: str = entry.data[CONF_HOST]

    player = DuneHDPlayer(host)

    opp.data.setdefault(DOMAIN, {})
    opp.data[DOMAIN][entry.entry_id] = player

    opp.config_entries.async_setup_platforms(entry, PLATFORMS)

    return True
Beispiel #6
0
async def async_setup_entry(hass, config_entry):
    """Set up a config entry."""
    host = config_entry.data[CONF_HOST]

    player = DuneHDPlayer(host)

    hass.data.setdefault(DOMAIN, {})
    hass.data[DOMAIN][config_entry.entry_id] = player

    for platform in PLATFORMS:
        hass.async_create_task(
            hass.config_entries.async_forward_entry_setup(
                config_entry, platform))

    return True
Beispiel #7
0
 async def init_device(self, host):
     """Initialize Dune HD player."""
     player = DuneHDPlayer(host)
     state = await self.hass.async_add_executor_job(player.update_state)
     if not state:
         raise CannotConnect()