-
Notifications
You must be signed in to change notification settings - Fork 2
devolo Motion Sensor
The following snippets assume, that you already created a working instance of HomeControl and an instance of Mydevolo. Please see the page about connecting to the backend for further information.
First you need to find the device UID of the motion sensor you want to query - in this snippet called "Backyard" located "Outside". Then you need to find the property "binary_sensor". Since the devolo Motion Sensors only have one sensor, you can directly access the first list object and access the state. There is also an attribute showing the date of the last change of the state. This date is of type datetime.
motion_sensor = homecontrol.devices.get(homecontrol.device_names.get("Backyard/Outside"))
binary_sensor = motion_sensor.get_property("binary_sensor")[0]
print(binary_sensor.state)
print(binary_sensor.last_activity)
Let's assume you want to query the same motion sensor as in the last chapter. To get the temperature or the light intensity, you have to find the property "multi_level_sensor". As there is obviously more than one sensor in the game, you have to inspect the sensor_type. Every value also comes with a unit.
multi_level_sensor = motion_sensor.get_property("multi_level_sensor")
for sensor in multi_level_sensor:
if sensor.sensor_type == "temperature":
print(sensor.value)
print(sensor.unit)
if sensor.sensor_type == "light":
print(sensor.value)
print(sensor.unit)