How to use the pyvera.VeraBinarySensor function in pyvera

To help you get started, we’ve selected a few pyvera examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pavoni / pyvera / tests / test_init.py View on Github external
def test_binary_sensor(
    vera_controller_data: VeraControllerData, device_id: int
) -> None:
    """Test function."""
    controller = vera_controller_data.controller
    device = cast(VeraBinarySensor, controller.get_device_by_id(device_id))
    controller.register(device, lambda device: None)

    assert device.is_tripped is False
    assert device.is_switched_on(refresh=True) is False

    update_device(
        controller_data=vera_controller_data,
        device_id=device_id,
        key="tripped",
        value="1",
    )
    assert device.is_tripped is True
    assert device.is_switched_on() is False

    update_device(
        controller_data=vera_controller_data,
github home-assistant / home-assistant / homeassistant / components / vera.py View on Github external
def map_vera_device(vera_device, remap):
    """Map vera classes to Home Assistant types."""
    import pyvera as veraApi
    if isinstance(vera_device, veraApi.VeraDimmer):
        return 'light'
    if isinstance(vera_device, veraApi.VeraBinarySensor):
        return 'binary_sensor'
    if isinstance(vera_device, veraApi.VeraSensor):
        return 'sensor'
    if isinstance(vera_device, veraApi.VeraArmableDevice):
        return 'switch'
    if isinstance(vera_device, veraApi.VeraLock):
        return 'lock'
    if isinstance(vera_device, veraApi.VeraThermostat):
        return 'climate'
    if isinstance(vera_device, veraApi.VeraCurtain):
        return 'cover'
    if isinstance(vera_device, veraApi.VeraSceneController):
        return 'sensor'
    if isinstance(vera_device, veraApi.VeraSwitch):
        if vera_device.device_id in remap:
            return 'light'
github home-assistant / home-assistant / homeassistant / components / vera / __init__.py View on Github external
def map_vera_device(vera_device, remap):
    """Map vera classes to Home Assistant types."""
    import pyvera as veraApi

    if isinstance(vera_device, veraApi.VeraDimmer):
        return "light"
    if isinstance(vera_device, veraApi.VeraBinarySensor):
        return "binary_sensor"
    if isinstance(vera_device, veraApi.VeraSensor):
        return "sensor"
    if isinstance(vera_device, veraApi.VeraArmableDevice):
        return "switch"
    if isinstance(vera_device, veraApi.VeraLock):
        return "lock"
    if isinstance(vera_device, veraApi.VeraThermostat):
        return "climate"
    if isinstance(vera_device, veraApi.VeraCurtain):
        return "cover"
    if isinstance(vera_device, veraApi.VeraSceneController):
        return "sensor"
    if isinstance(vera_device, veraApi.VeraSwitch):
        if vera_device.device_id in remap:
            return "light"