INNER CODE UNIT · Python

async_setup_entry

jseidl/magic-areas · custom_components/magic_areas/media_player/__init__.py:29

async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the area media player config entry."""

    area: MagicArea | None = get_area_from_config_entry(hass, config_entry)
    assert area is not None

    entities_to_add: list[AreaAwareMediaPlayer | AreaMediaPlayerGroup] = []

    # Media Player Groups
    if area.has_feature(CONF_FEATURE_MEDIA_PLAYER_GROUPS):
        _LOGGER.debug("%s: Setting up media player groups.", area.name)
        entities_to_add.extend(setup_media_player_group(area))

    # Check if we are the Global Meta Area
    if area.is_meta() and area.id == META_AREA_GLOBAL.lower():
        # Try to setup AAMP
        _LOGGER.debug("%s: Setting up Area-Aware media player", area.name)
        entities_to_add.extend(setup_area_aware_media_player(area))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…