Is it somehow possible to setup the RaZberry to receive events of an EZmotion sensor and call some bash scripts?
In the documentation I find some trigger info, but I can not understand how to link the parts together?
Command line examples for triggers
Try something like this: zway
Try something like this: zway.devices[X].instances[0].commandClasses.SwtichBinary.data.level.bind(function() {system("echo " + this.value);});
not working....
after much trying I can not make it work.
I am calling:
$/usr/bin/curl -s -LN --globoff 'http://__ipaddress__:8083/ZWaveAPI/Run/devices[X].instances[0].commandClasses[49].data[1].val.bind(function(){system("echo "+this.value);});'
and I only get:
>JavaScript compilation error: Uncaught SyntaxError: Unexpected token ILLEGAL
If i leave the system empty, like ....system();.... or I just do ...system("echo").... it does not give the error. Always if i put spaces or "this.value" into the function, this error occures.
If I just put the "echo" in, if the event is triggered the script is not run.
On the other hand
$/usr/bin/curl -s -LN --globoff 'http://:8083/ZWaveAPI/Run/devices[X].instances[0].commandClasses[49].data[1].val.unbind()'
>null
seems to work.
What am I doing wrong?
Very confusing is the log output. It almost shows in real time events that are received via the z-wave system, but these binds are just shown like 5-10 mins. later in a batch of messages. This is wanted behaviour?
I am calling:
$/usr/bin/curl -s -LN --globoff 'http://__ipaddress__:8083/ZWaveAPI/Run/devices[X].instances[0].commandClasses[49].data[1].val.bind(function(){system("echo "+this.value);});'
and I only get:
>JavaScript compilation error: Uncaught SyntaxError: Unexpected token ILLEGAL
If i leave the system empty, like ....system();.... or I just do ...system("echo").... it does not give the error. Always if i put spaces or "this.value" into the function, this error occures.
If I just put the "echo" in, if the event is triggered the script is not run.
On the other hand
$/usr/bin/curl -s -LN --globoff 'http://:8083/ZWaveAPI/Run/devices[X].instances[0].commandClasses[49].data[1].val.unbind()'
>null
seems to work.
What am I doing wrong?
Very confusing is the log output. It almost shows in real time events that are received via the z-wave system, but these binds are just shown like 5-10 mins. later in a batch of messages. This is wanted behaviour?
Make sure to URL encode "+"
Make sure to URL encode "+" sign into "%2B".
As for the delay in logs, the JS logging is buffered and appears once enough data is collected. We will try to change this in future.
As for the delay in logs, the JS logging is buffered and appears once enough data is collected. We will try to change this in future.
This was a good tip, but one
This was a good tip, but one has to URL encode the whole thing:
$/usr/bin/curl -s -LN --globoff 'http://__ipaddress__:8083/ZWaveAPI/Run/devices[3].instances[0].commandClasses[48].data.level.bind(function()%20%7B%0Asystem(%22/usr/local/bin/test%20%22%20%2B%20this.value)%3B%0A%7D);'
>null
This is not really desireable because it makes administration very hard. Even think of more difficult js scripts which should be triggered...
Do you see a different way to approach this?
Secondly the bind does not really work:
After the bind I get this in the log:
[2013-03-29 ] RECEIVED: ( 01 09 00 04 00 03 03 20 01 FF 2C )
[2013-03-29 ] SENT ACK
[2013-03-29 ] SETDATA devices.3.data.lastReceived = 0 (0x00000000)
[2013-03-29 ] SETDATA devices.3.instances.0.commandClasses.48.data.level = True
That's it. The execution of the binded function is not logged...and did not really work therefore.
But then... I waited again and I received the following message in the log:
>Callback execution error: Uncaught System commands are not configured
(These buffered JS log entries are really0 not helping...)
Can you please tell me, what this means and how to avoid it, so that the trigger works?
$/usr/bin/curl -s -LN --globoff 'http://__ipaddress__:8083/ZWaveAPI/Run/devices[3].instances[0].commandClasses[48].data.level.bind(function()%20%7B%0Asystem(%22/usr/local/bin/test%20%22%20%2B%20this.value)%3B%0A%7D);'
>null
This is not really desireable because it makes administration very hard. Even think of more difficult js scripts which should be triggered...
Do you see a different way to approach this?
Secondly the bind does not really work:
After the bind I get this in the log:
[2013-03-29 ] RECEIVED: ( 01 09 00 04 00 03 03 20 01 FF 2C )
[2013-03-29 ] SENT ACK
[2013-03-29 ] SETDATA devices.3.data.lastReceived = 0 (0x00000000)
[2013-03-29 ] SETDATA devices.3.instances.0.commandClasses.48.data.level = True
That's it. The execution of the binded function is not logged...and did not really work therefore.
But then... I waited again and I received the following message in the log:
>Callback execution error: Uncaught System commands are not configured
(These buffered JS log entries are really0 not helping...)
Can you please tell me, what this means and how to avoid it, so that the trigger works?
Well, in your case URL
Well, in your case URL encoding is not fully done by curl. This has nothing to do with z-way.
For convenience you can put the script on a file and use executeJS to load it instead of doing it in the URL.
As for the bind call, it should work. Might it be that it works, but you don't see the result in the log due to cache? Please try to write some file on the disk from this system call.
For convenience you can put the script on a file and use executeJS to load it instead of doing it in the URL.
As for the bind call, it should work. Might it be that it works, but you don't see the result in the log due to cache? Please try to write some file on the disk from this system call.
By the way, our programmer
By the way, our programmer suggests to create the file of allowed commands .syscommands
Please refer to the manual for more info
Please refer to the manual for more info
> Please refer to the manual
> Please refer to the manual for more info (about "..to create the file of allowed commands .syscommands")
What manual do you mean?
http://en.z-wave.me/docs/zway_manual_en.pdf ?
What manual do you mean?
http://en.z-wave.me/docs/zway_manual_en.pdf ?
.syscommands location and syntax
I'm also interested in using command line triggers but can't seem to find info about the .syscommands file in the manual (http://en.z-wave.me/docs/zway_manual_en.pdf). Can you give some directions? Thanks!
Afaik that manual is for Z
Afaik that manual is for Z-Cloud not Razberry. The 70+ page detailed manual that used to be on the Razberry website has been withdrawn and replaced by a 4 page summary.
Since 29-12-2016 I am no longer a moderator for this forum