How to use the pydeconz.sensor.GenericStatus 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_init.py View on Github external
"pydeconz.DeconzSession.request",
        new=CoroutineMock(
            return_value={
                "config": {"bridgeid": "012345"},
                "groups": {
                    "g1": {
                        "id": "gid",
                        "scenes": [{"id": "sc1", "name": "scene1"}],
                        "state": {},
                        "action": {},
                        "lights": [],
                    }
                },
                "lights": {"l1": {"state": {}}},
                "sensors": {
                    "s1": {"type": GenericStatus.ZHATYPE[0], "state": {}, "config": {}}
                },
            }
        ),
    ):
        await session.initialize()
    assert "g1" in session.groups
    assert session.groups["g1"].id == "gid"
    assert "sc1" in session.groups["g1"].scenes
    assert session.groups["g1"].deconz_id == "/groups/g1"
    assert session.groups["g1"].scenes["sc1"].id == "sc1"
    assert "l1" in session.lights
    assert session.lights["l1"].deconz_id == "/lights/l1"
    assert "s1" in session.sensors
    assert session.sensors["s1"].deconz_id == "/sensors/s1"
    assert session.sensors["s1"].type == GenericStatus.ZHATYPE[0]
github Kane610 / deconz / tests / test_init.py View on Github external
"s1": {"type": GenericStatus.ZHATYPE[0], "state": {}, "config": {}}
                },
            }
        ),
    ):
        await session.initialize()
    assert "g1" in session.groups
    assert session.groups["g1"].id == "gid"
    assert "sc1" in session.groups["g1"].scenes
    assert session.groups["g1"].deconz_id == "/groups/g1"
    assert session.groups["g1"].scenes["sc1"].id == "sc1"
    assert "l1" in session.lights
    assert session.lights["l1"].deconz_id == "/lights/l1"
    assert "s1" in session.sensors
    assert session.sensors["s1"].deconz_id == "/sensors/s1"
    assert session.sensors["s1"].type == GenericStatus.ZHATYPE[0]
github Kane610 / deconz / pydeconz / sensor.py View on Github external
    @property
    def water(self):
        """Water detected."""
        return self.raw["state"].get("water")


SENSOR_CLASSES = (
    Alarm,
    Battery,
    CarbonMonoxide,
    Consumption,
    Daylight,
    Fire,
    GenericFlag,
    GenericStatus,
    Humidity,
    LightLevel,
    OpenClose,
    Power,
    Presence,
    Pressure,
    Switch,
    Temperature,
    Thermostat,
    Vibration,
    Water,
)


def create_sensor(sensor_id, raw, request):
    """Simplify creating sensor by not needing to know type."""