Page 1 of 1

How to generate a short (1 second) negative pulse

Posted: Thursday 14 January 2016 11:40
by PBdA
Hello,
I have a zwave relay (Qubino ZMNHND1 Flush 1D relay) which commands an alarm. The relay is normally closed and to arm or disarm alarm, it should open for a short time and then close. I have tried a lua script:

Code: Select all

commandArray[1] = {['Alarm command'] = 'Off'}
commandArray[2] = {['Alarm command'] = 'On AFTER 1'}
but it does nothing. This works only for a pulse >= 3 seconds:

Code: Select all

commandArray[1] = {['Alarm command'] = 'Off'}
commandArray[2] = {['Alarm command'] = 'On AFTER 3'}
It's possible to generate a short positive pulse with a scene:

Code: Select all

Command: On
On delay: 0
Off delay: 1
But it doesn't work for an Off command:

Code: Select all

Command: Off
On delay: 1
Off delay: 0
Switch goes Off immediately but never return to on.

Re: How to generate a short (1 second) negative pulse

Posted: Tuesday 26 January 2016 23:22
by jautem
can you use sleep function in lua script , turn off , sleep 3 et turn back on ?

Re: How to generate a short (1 second) negative pulse

Posted: Tuesday 26 January 2016 23:42
by PBdA
jautem wrote:can you use sleep function in lua script , turn off , sleep 3 et turn back on ?
Sleep is a bad thing in lua script because it blocks execution of other scripts. Furthermore, I think it doesn't work because commandArray is executed at once when script return.

Re: How to generate a short (1 second) negative pulse

Posted: Wednesday 27 January 2016 12:22
by jautem
so perhaps fork another script like shell in lua source script , and shell script will sleep and use api to finish job ?

Re: How to generate a short (1 second) negative pulse

Posted: Wednesday 27 January 2016 15:24
by PBdA
Nice idea but I have taken another way: Qubino ZMNHND1 Flush 1D relay can be configured to return to On by itself with a configurable delay. I had to use a recent OpenZwave config but it works.
Thank you for your help.