Search found 8 matches

by gugrim
07 May 2022 19:53
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Re: Simple Scripting trigger vdev ID

I was never in doubt that the deactivation problem was made by me, since it worked fine before I started messing with the code. I mentioned it in the hope that someone would spot the error. Anyway, I have now added the check you suggested. Works fine! The new diff: 47c47 < this.onEvent = function(tr...
by gugrim
01 May 2022 20:10
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Re: Simple Scripting trigger vdev ID

Solved the deactivation problem. Mapped all installed event handling functions to their vDevIds to ensure that the exact same function is passed to controller.devices.off when deactivating. New diff: 47c47 < this.onEvent = function(trigger) { --- > this.onEvent = function() { 55d54 < self.trigger = ...
by gugrim
30 Apr 2022 20:55
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Re: Simple Scripting trigger vdev ID

Also noticed that deactivating the script isn't enough to stop it from being invoked. I have to restart the z-way-server service after deactivation otherwise the deactivation seems to be ignored.
by gugrim
30 Apr 2022 20:34
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Re: Simple Scripting trigger vdev ID

I finally got it to work. The problem was with my attempt to invoke the script and pass the trigger as a parameter. Now I simply set it on self inside the onEvent function. The complete diff: 47c47 < this.onEvent = function() { --- > this.onEvent = function(trigger) { 54a55 > self.trigger = trigger;...
by gugrim
30 Apr 2022 09:58
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Re: Simple Scripting trigger vdev ID

I can do that as a workaround. Easy but a bit ugly. I have a lot of devices and if I duplicate the script and then want to change it I have to go through all of them. And if I for some reason would like to deactivate the script for a while, I have do deactivate all of them.
by gugrim
28 Apr 2022 16:30
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Re: Simple Scripting trigger vdev ID

Thanks for your reply. Sadly I'm not a JavaScript expert. I tried to make it work with some changes but I must have done some mistake: I changed the onEvent function to take a trigger: this.onEvent = function(trigger) { The trigger is passed to the script: (function(global, self, trigger, vdev, setT...
by gugrim
25 Apr 2022 20:46
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Re: Simple Scripting trigger vdev ID

I sure hope there is some way to get the ID of the vdev that caused the event. I have many devices and I want to report all changes for statistics and other purposes. Checking the value of every device still wouldn't tell me which one caused the event. ZWay has just called my script because of some ...
by gugrim
25 Apr 2022 16:35
Forum: Discussions in English
Topic: Simple Scripting trigger vdev ID
Replies: 14
Views: 7994

Simple Scripting trigger vdev ID

Hi! The Simple Scripting app looks promising but I haven't found much documentation. I'd like to write a very simple script that notifies an external REST API whenever one of several devices change state and trigger events. I've seen that you can list multiple event triggers but how do I know which ...