Example #1
0
async def async_get_zeroconf(hass: "HomeAssistant") -> Dict[str, List]:
    """Return cached list of zeroconf types."""
    zeroconf: Dict[str, List] = ZEROCONF.copy()

    integrations = await async_get_custom_components(hass)
    for integration in integrations.values():
        if not integration.zeroconf:
            continue
        for typ in integration.zeroconf:
            zeroconf.setdefault(typ, [])
            if integration.domain not in zeroconf[typ]:
                zeroconf[typ].append(integration.domain)

    return zeroconf
Example #2
0
async def async_get_zeroconf(hass: "HomeAssistant") -> Dict[str, List[Dict[str, str]]]:
    """Return cached list of zeroconf types."""
    zeroconf: Dict[str, List[Dict[str, str]]] = ZEROCONF.copy()

    integrations = await async_get_custom_components(hass)
    for integration in integrations.values():
        if not integration.zeroconf:
            continue
        for entry in integration.zeroconf:
            data = {"domain": integration.domain}
            if isinstance(entry, dict):
                typ = entry["type"]
                entry_without_type = entry.copy()
                del entry_without_type["type"]
                data.update(entry_without_type)
            else:
                typ = entry

            zeroconf.setdefault(typ, []).append(data)

    return zeroconf
Example #3
0
async def async_get_zeroconf(
    hass: HomeAssistant, ) -> dict[str, list[dict[str, str | dict[str, str]]]]:
    """Return cached list of zeroconf types."""
    zeroconf: dict[str, list[dict[
        str,
        str | dict[str, str]]]] = ZEROCONF.copy()  # type: ignore[assignment]

    integrations = await async_get_custom_components(hass)
    for integration in integrations.values():
        if not integration.zeroconf:
            continue
        for entry in integration.zeroconf:
            data: dict[str, str | dict[str, str]] = {
                "domain": integration.domain
            }
            if isinstance(entry, dict):
                typ = entry["type"]
                data.update(async_process_zeroconf_match_dict(entry))
            else:
                typ = entry

            zeroconf.setdefault(typ, []).append(data)

    return zeroconf