Page 1 of 1

How to get datas from RaZberry+Aeotec Door sensor

Posted: 18 Jul 2019 00:42
by tanimadinmiben
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

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

Posted: 18 Jul 2019 03:16
by PoltoS
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