How to get datas from RaZberry+Aeotec Door sensor

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
tanimadinmiben
Posts: 5
Joined: 07 Jul 2019 11:20

How to get datas from RaZberry+Aeotec Door sensor

Post by tanimadinmiben » 18 Jul 2019 00:42

Hi,

I am able to get datas from z-way-server.log file and display it on the terminal. But I want to get datas with python script and send the datas maybe to server. I do not want to use log file, it only gets the last line of the file and display it. But I do not how to do it, is there a topic or tutorial?

Code: Select all

#!/bin/bash
FILEPATH="/var/log/z-way-server.log"
while :
do
        DATA=$(sudo tail -n1 "$FILEPATH" | grep --line-buffered device-info | sed -r 's/.{115}//; s/.{15}$//')
        sleep 1
        echo "$DATA"
done

User avatar
PoltoS
Posts: 4846
Joined: 26 Jan 2011 19:36

Re: How to get datas from RaZberry+Aeotec Door sensor

Post by PoltoS » 18 Jul 2019 03:16

Do not do it via logs - logs are for debugging and investigations only.

Please check the Z-Way manual https://github.com/Z-Wave-Me/Z-Way-Manu ... Manual.pdf

You can run JS scripts on the backend to execute different actions instantly. In your case it would be:
subscribe to device change using
controller.devices.on("change:metrics:level", function() {}) // all devices changes
controller.devices.get("__deviceId__").on("change:metrics:level", function() {}) // a specific device changes
zway.devices[__id__].SwitchBinary.data.level.bind(function(){}) // use low level API
system("command") // to execute your python script - don't forget to edit .syscommands file
http.request(...) // to send an HTTP request to another service

Hope this helps

Post Reply