Page 1 of 1

Help with CodeDevice

Posted: 28 Jul 2017 22:49
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!

Re: Help with CodeDevice

Posted: 29 Jul 2017 03:08
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.

Re: Help with CodeDevice

Posted: 29 Jul 2017 11:35
by stich86
thanks!
this solved the issue