Page 1 of 1

Zway JS Apps

Posted: 12 Dec 2015 10:42
by marco
Dear All,
I’m writing because I’m searching to deep some zway Apps. I looked around to find some example of using JS Apps (Load custom JavaScript code, Load custom JavaScript code for Z-Wave application and Load custom JavaScript file) but I wasn’t able to find something useful to me.
Could you please post some basic indications on how they work and some simple example to quickly test them using common devices (such as binary switch)?
Thanks
Marco

Re: Zway JS Apps

Posted: 14 Dec 2015 04:17
by PoltoS
May be CodeDevice is something you want to start with?

Re: Zway JS Apps

Posted: 10 Jan 2016 11:00
by marco
Hi,
Actually I was looking for something like the following:

Load custom Java Script Code

zway.devices[26].instances[0].DoorLock.data.mode.bind(function() {
var status = (zway.devices[26].instances[0].DoorLock.data.mode.value);
if (status == false)
zway.devices[5].instances[0].commandClasses[0x20].Set(255);
});

This simple code turn ON a light when someone unlock the door.

May be I'm wrong but I think that Code Device is not so useful for this kind of action.
Thank you in any case
Marco

Re: Zway JS Apps

Posted: 11 Jan 2016 23:27
by PoltoS
Yes, binding is better to do here. But note that on start this code starts before Z-Wave binding, so you need to stop-start it. Another solution will be to use new module with similiar name instead (will work in next RC)

Re: Zway JS Apps

Posted: 12 Jan 2016 04:51
by Plainsane
I'm curios, would the if the rule work for you?

Re: Zway JS Apps

Posted: 16 Jan 2016 19:35
by bogr
marco wrote: Load custom Java Script Code
Did you get the JavaScript module to work? I've just had bad experience with this so it would be interesting to hear about your solution.

Re: Zway JS Apps

Posted: 05 Feb 2016 22:23
by marco
Hi,

to Plainsane
Yes, the if rule work fine. Some problem happen sometime but they'r not related to the rule.

to Bogr
Yes I can state that JS Apps work fine for me. Since beginning, every day, 2 Schedule modules turn ON/OFF a light. A JS module send me an email on that light activity. No fault till now.