Help with CodeDevice

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
stich86
Posts: 9
Joined: 23 Jul 2017 23:51

Help with CodeDevice

Post by stich86 »

Hi guys,

i'm trying to implement a Virtual Button to enable or disable an application using a bash script.
I've enabled on the .syscommand the directory where is the script and my On\Off command works as expected:

On: system('/opt/z-way-server/automation/scripts/lares.sh IP');
Off: system('/opt/z-way-server/automation/scripts/lares.sh D');
Status: system('/opt/z-way-server/automation/scripts/lares.sh PT');

The script launched with parameter PT report simply on/off (i've tried also with the double ') but on the GUI the Button is marked as off.. and this is the log from z-way server:

[2017-07-28 21:47:13.691] [core] Notification: device-info (device-OnOff): {"dev":"App Status","l":[0,"off"]}
[2017-07-28 21:47:13.715] [core] [BaseModule-10] Set lastLevel to 0,off for Code_Device_switchBinary_12 (was 0,off)

the message is the same also if the status is "on"

Any help?

Thanks!
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Help with CodeDevice

Post by PoltoS »

note that system do not just return the output of your command, but an array: ret[0] = status code, ret[1] = text. You can see it in the Z-Way reference.

So use system('/opt/z-way-server/automation/scripts/lares.sh PT')[1] instead.
stich86
Posts: 9
Joined: 23 Jul 2017 23:51

Re: Help with CodeDevice

Post by stich86 »

thanks!
this solved the issue
Post Reply