Script to change state on app.

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
elmaco
Posts: 6
Joined: 19 Feb 2020 17:07

Script to change state on app.

Post by elmaco » 19 Feb 2020 17:12

Hello, is there a way to change the state on an app like Dummy_device outside the Z-wave server?
For an example a BashScript or python script.

Best regards/
Marcus

micky1500
Posts: 107
Joined: 07 Feb 2016 16:29

Re: Script to change state on app.

Post by micky1500 » 20 Feb 2020 00:10

I use Arduino to change z-wave device settings, so similar.
http://192.168.1.89:8083/ZAutomation/ap ... ommand/off
i got the device name by looking at the log.. tail -f /var/log/z-way-server.log
it gets more complicated tho, because you need to be logged on for it to work.
so python script is probably best.
Raspi 4(Buster), Zwave Version 3.0.4

elmaco
Posts: 6
Joined: 19 Feb 2020 17:07

Re: Script to change state on app.

Post by elmaco » 20 Feb 2020 17:27

Hi thanks for reply and it sound promising, but how do i include user and password, i have tried:
http://username:password@yourip:8083....

but it says "Not logged in" or"{"data":null,"code":401,"message":"401 Unauthorized","error":"Not logged in"}"
Any ides?

micky1500
Posts: 107
Joined: 07 Feb 2016 16:29

Re: Script to change state on app.

Post by micky1500 » 20 Feb 2020 21:01

That format works when I try it.
Try enabling API.

Configuration icon
APPS
Z-Wave Network Access
turn on - Enable Z-Wave API
Raspi 4(Buster), Zwave Version 3.0.4

elmaco
Posts: 6
Joined: 19 Feb 2020 17:07

Re: Script to change state on app.

Post by elmaco » 23 Feb 2020 17:48

Perfekt thanks.
So this is what i did, i made an Python script with this lines:

Code: Select all

Import os
os.system('curl -s -LN --globoff http://user:password@IP:8083/ZAutomation/api/v1/devices/DummyDevice_33/command/on')

It might be an better way, but it does the job for me. :)

Post Reply