Page 1 of 1

Struggling with CodeDevice

Posted: 01 Sep 2015 20:22
by praes
Hi guys,

I am really new to this Z-Wave thing, however I want to do some little tests. I searched a couple of hours for a solution but I've found absolutely nothing, maybe some of you experienced guys can help me.

Following problem:

I definded a Code Device witch is called TestButton and it is a switchBinary.
Code for on: system('echo "1" > /sys/class/gpio/gpio19/value');
Code for off: system('echo "0" > /sys/class/gpio/gpio19/value');
Code for status <--- here the problem occurs,
if i write system('printf "on"'); the switch in the gui always turns to off and
if I write system('printf "off"'); the same behavior, gui shows off. (Tested also with echo but the other problem is the \n the echo command returns)...

So what am I doing wrong here? I want to switch a LED connected to gpio pin 19 on raspberri pi, the switching works flawlessly, can turn on and off with the code above, but the polling for the status doesn't work.
First attempt is to write something in this field to get always status on, for testing purposes), like the printf "on".

greets,
Patrick

Re: Struggling with CodeDevice

Posted: 02 Sep 2015 01:00
by PoltoS
Have you edited automation/.syscommands to allow printf?
BTW, echo -n will suppress \n.
First try with just "on". Does it work like on?

Re: Struggling with CodeDevice

Posted: 02 Sep 2015 02:06
by praes
Hi, thanks for the reply.
I allowed all those comands in the syscomands file.
Tried with on and "on" and 'on' always shows off. Can you give it a try? I installed recent Version of the software today. Maybe its a bug and in prior Version ist works?



Update:

Testet with only: "on" (with the quotes) in the code line and now it shows on.
Can you give me a hint on how to achieve that with the system comand like system('echo -n on'); ?


Greets,
Patrick

Re: Struggling with CodeDevice

Posted: 02 Sep 2015 18:28
by praes
Hi,

I finally found the solution I need to do the following:
system('echo -n "on"')[1]; because the system comand gives an array like [ '0' , 'on' ].

Now it's finally working :-)

Greets,
Patrick