INNER CODE UNIT · Python

create_wasp_in_a_box_sensor

jseidl/magic-areas · custom_components/magic_areas/binary_sensor/__init__.py:112

def create_wasp_in_a_box_sensor(
    area: MagicArea,
) -> list[AreaWaspInABoxBinarySensor]:
    """Add the Wasp in a box sensor for the area."""

    if not area.has_feature(CONF_FEATURE_WASP_IN_A_BOX) or not area.has_feature(
        CONF_FEATURE_AGGREGATION
    ):
        return []

    try:
        return [AreaWaspInABoxBinarySensor(area)]
    except Exception as e:  # pylint: disable=broad-exception-caught
        _LOGGER.error(
            "%s: Error creating wasp in a box sensor: %s",
            area.slug,
            str(e),
        )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…