Read out Z-Wave device on razberry

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
sc0rpi0n16
Posts: 2
Joined: 20 Oct 2016 12:42

Read out Z-Wave device on razberry

Post by sc0rpi0n16 »

Dear community,

I am completely new to z-wave and razberry. I hope this question is not redundant, but I didn't found anything on the web concerning the following:

I have a raspberry pi 3 with the razberry modul and as a first z-wave device a cyrus multisensor.
Everything works fine and I can work with the Web UI.

My question is now, is there a possibility to read out the sensors of the z-wave device via command line of the raspberry pi? That I can use the information of the z-wave devices in my own scripts?

Thanks for the suggestions and answers in advance
Cheers
gazier20
Posts: 7
Joined: 14 Oct 2016 21:35

Re: Read out Z-Wave device on razberry

Post by gazier20 »

Hi,

I'm not expert. I'm currently doing the setup of my crontab in my Raspberry pi.

Here is a french website : http://www.magdiblog.fr/domotique/contr ... -razberry/

At the end there is some examples of script like :

wget -o ./z-way.api -O ./z-way.api http://127.0.0.1:8083/ZWaveAPI/Run/devi ... %28$val%29

This particular command line doesn't work for me. I opened a post yesterday to understand why this command line doesn't work when the same url works in a web browser.

I'm still looking for a solution.

Let me know if you find a solution.
gazier20
Posts: 7
Joined: 14 Oct 2016 21:35

Re: Read out Z-Wave device on razberry

Post by gazier20 »

You're my booster. I found the solution in this forum : https://forum.z-wave.me/viewtopic.php?f=3419&t=22778

To do this from the command line you need to authenticate first and save a session cookie...

wget -q --header "Accept: application/json" --header "Content-Type: application/json" --post-data '{"form":true,"login":"admin","password":"admin","keepme":false,"default_ui":1}' http://127.0.0.1:8083/ZAutomation/api/v1/login --keep-session-cookie --save-cookie /tmp/zway-cookie.txt -O - 1>&2 >/dev/null

Then you use that session cookie for all subsequent requests with --load-cookies.

wget --load-cookies /tmp/zway-cookie.txt "http://127.0.0.1:8083/ZWaveAPI/Run/devi ... ].Set(255)" - O - 1>&2 >/dev/null

I hope it helps.
sc0rpi0n16
Posts: 2
Joined: 20 Oct 2016 12:42

Re: Read out Z-Wave device on razberry

Post by sc0rpi0n16 »

Hi gazier20,

Thank you for your answer, that helped a lot.
I didn't quite managed it to get it working with the "wget" command but on this page (http://razberry.z-wave.me/index.php?id=13) I found the following which works for me:

Get a token with the following command:

Code: Select all

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"form": true, "login": "admin", "password": "admin", "keepme": false, "default_ui": 1}' 192.168.0.62:8083/ZAutomation/api/v1/login -c cookie.txt
Then for example one can extract the value of a temperature sensor (or any other sensor) with:

Code: Select all

curl -g http://192.168.178.88:8083/ZWaveAPI/Run/devices[4].instances[0].commandClasses[49].data[1].val.value -b cookie.txt
"ZWaveAPI" can also be exchanges with "ZWave.zway". The option "-g" in the curl command assurs that square brackets can be used in the link.
To also Set the values of different devices one can use the following (example for a command class SwitchBinary):

Code: Select all

curl -g "192.168.178.88:8083/ZWaveAPI/Run/devices[6].instances[0].commandClasses[37].Set(1)" -b cookie.txt
The syntax of the available API commands can be found here: http://razberry.z-wave.me/docs/zwayDev.pdf

Maybe this is helpful for some people.

Greetings!
scorpion
Post Reply