How to use the pydeconz.sensor.create_sensor function in pydeconz

To help you get started, we’ve selected a few pydeconz 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 Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_consumption_sensor():
    """Verify that consumption sensor works."""
    sensor = create_sensor("0", FIXTURE_CONSUMPTION, None)

    assert sensor.BINARY is False
    assert sensor.ZHATYPE == ("ZHAConsumption",)

    assert sensor.state == 11.342
    assert sensor.consumption == 11342
    assert sensor.power == 123

    # DeconzSensor
    assert sensor.battery is None
    assert sensor.ep == 1
    assert sensor.lowbattery is None
    assert sensor.on is True
    assert sensor.reachable is True
    assert sensor.tampered is None
    assert sensor.secondary_temperature is None
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_create_sensor_fails():
    """Verify failing behavior for create_sensor."""
    sensor_id = "0"
    sensor = {"type": "not supported", "name": "name"}
    result = create_sensor(sensor_id, sensor, None)

    assert result.BINARY is None
    assert not result.ZHATYPE
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_create_sensor():
    """Verify that create-sensor can create all types."""
    assert len(SENSOR_CLASSES) == 19

    sensor_id = "0"

    for sensor_class in SENSOR_CLASSES:
        for sensor_type in sensor_class.ZHATYPE:
            sensor = {"type": sensor_type, "config": {}, "state": {}}
            result = create_sensor(sensor_id, sensor, None)

            assert result
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_lightlevel_sensor():
    """Verify that light level sensor works."""
    sensor = create_sensor("0", FIXTURE_LIGHTLEVEL, None)

    assert sensor.BINARY is False
    assert sensor.ZHATYPE == ("ZHALightLevel", "CLIPLightLevel")

    assert sensor.state == 5
    assert sensor.dark is True
    assert sensor.daylight is False
    assert sensor.lightlevel == 6955
    assert sensor.lux == 5
    assert sensor.tholddark == 12000
    assert sensor.tholdoffset == 7000

    # DeconzSensor
    assert sensor.battery == 100
    assert sensor.ep == 2
    assert sensor.lowbattery is None
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_genericstatus_sensor():
    """Verify that generic flag sensor works."""
    sensor = create_sensor("0", FIXTURE_GENERICSTATUS, None)

    assert sensor.BINARY is False
    assert sensor.ZHATYPE == ("CLIPGenericStatus",)

    assert sensor.state == 0
    assert sensor.status == 0

    # DeconzSensor
    assert sensor.battery is None
    assert sensor.ep is None
    assert sensor.lowbattery is None
    assert sensor.on is True
    assert sensor.reachable is True
    assert sensor.tampered is None
    assert sensor.secondary_temperature is None
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_thermostat_sensor():
    """Verify that thermostat sensor works."""
    sensor = create_sensor("0", FIXTURE_THERMOSTAT, None)

    assert sensor.BINARY is False
    assert sensor.ZHATYPE == ("ZHAThermostat", "CLIPThermostat")

    assert sensor.state == 21.5
    assert sensor.heatsetpoint == 21.00
    assert sensor.locked is False
    assert sensor.mode == "auto"
    assert sensor.offset == 0
    assert sensor.state_on is False
    assert sensor.temperature == 21.5
    assert sensor.valve == 0

    # DeconzSensor
    assert sensor.battery == 100
    assert sensor.ep == 1
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_temperature_sensor():
    """Verify that temperature sensor works."""
    sensor = create_sensor("0", FIXTURE_TEMPERATURE, None)

    assert sensor.BINARY is False
    assert sensor.ZHATYPE == ("ZHATemperature", "CLIPTemperature")

    assert sensor.state == 21.8
    assert sensor.temperature == 21.8

    # DeconzSensor
    assert sensor.battery == 100
    assert sensor.ep == 1
    assert sensor.lowbattery is None
    assert sensor.on is True
    assert sensor.reachable is True
    assert sensor.tampered is None
    assert sensor.secondary_temperature is None
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_power_sensor():
    """Verify that power sensor works."""
    sensor = create_sensor("0", FIXTURE_POWER, None)

    assert sensor.BINARY is False
    assert sensor.ZHATYPE == ("ZHAPower",)

    assert sensor.state == 64
    assert sensor.current == 34
    assert sensor.power == 64
    assert sensor.voltage == 231

    # DeconzSensor
    assert sensor.battery is None
    assert sensor.ep == 1
    assert sensor.lowbattery is None
    assert sensor.on is True
    assert sensor.reachable is True
    assert sensor.tampered is None
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_presence_sensor():
    """Verify that presence sensor works."""
    sensor = create_sensor("0", FIXTURE_PRESENCE, None)

    assert sensor.BINARY is True
    assert sensor.ZHATYPE == ("ZHAPresence", "CLIPPresence")

    assert sensor.state is False
    assert sensor.is_tripped is False
    assert sensor.presence is False
    assert sensor.dark is None
    assert sensor.duration is None

    # DeconzSensor
    assert sensor.battery == 100
    assert sensor.ep == 2
    assert sensor.lowbattery is None
    assert sensor.on is True
    assert sensor.reachable is True
github Kane610 / deconz / tests / test_sensors.py View on Github external
async def test_fire_sensor():
    """Verify that fire sensor works."""
    sensor = create_sensor("0", FIXTURE_FIRE, None)

    assert sensor.BINARY is True
    assert sensor.ZHATYPE == ("ZHAFire",)

    assert sensor.state is False
    assert sensor.is_tripped is False
    assert sensor.fire is False

    # DeconzSensor
    assert sensor.battery is None
    assert sensor.ep == 1
    assert sensor.lowbattery is None
    assert sensor.on is True
    assert sensor.reachable is True
    assert sensor.tampered is None
    assert sensor.secondary_temperature is None