Page 1 of 1
State change in RaZ webapp to exec console (bash) command?
Posted: 21 Sep 2016 20:43
by anom3
Hi.
I have yet to even start digging in, but thought it would better to ask before I start:
I would like to have a z-wave device state change (as shown in the web app) execute a bash command line. What is the proper way of going at this? Should I just be pooling the API?
Thanks!
Re: State change in RaZ webapp to exec console (bash) comman
Posted: 22 Sep 2016 00:58
by anom3
A bit more info:
A) If the states of the devices are stored anywhere on the filesystem that would be better then going via the API.
B) Ideally, having a trigger -> execute command line would be the best.
Re: State change in RaZ webapp to exec console (bash) comman
Posted: 22 Sep 2016 12:04
by pz1
anom3 wrote:I would like to have a z-wave device state change (as shown in the web app) execute a bash command line. What is the proper way of going at this? Should I just be pooling the API?
Except for a few older (mostly USA) Z-wave devices, most do signal a state change to the controller. So no need to do costly polling.
I would try something along this (not tested)
- Use app
CodedDevice to make a Toggle device and enter the Javascript code system("yourbash.sh")
- Add the name of yourbash.sh to file /opt/z-way-server/automation/.syscommands
- Use app
IFTHEN or
LogicalRule that fires on your event and activate.
If you run into trouble, search this forum. There are more examples of using bash commands here. Alternatively see the
DevelopersManual