Script to change state on app.

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

Script to change state on app.

Post by elmaco »

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: 298
Joined: 07 Feb 2016 16:29
Location: England

Re: Script to change state on app.

Post by micky1500 »

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 - 32 Bit) Zwave Version 4.1.1, Raz 7 Pro, Serial API Version: 07.38
elmaco
Posts: 10
Joined: 19 Feb 2020 17:07

Re: Script to change state on app.

Post by elmaco »

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: 298
Joined: 07 Feb 2016 16:29
Location: England

Re: Script to change state on app.

Post by micky1500 »

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 - 32 Bit) Zwave Version 4.1.1, Raz 7 Pro, Serial API Version: 07.38
elmaco
Posts: 10
Joined: 19 Feb 2020 17:07

Re: Script to change state on app.

Post by elmaco »

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