Sending command to raspberry

Discussions about Z-Way software and Z-Wave technology in general
Markus96
Posts: 9
Joined: 29 Jul 2016 11:04

Sending command to raspberry

Post by Markus96 »

Hello everybody!

What I want to do:

I'm using a raspberry pi and z-wave for smart control of my flat. I'm searching for an app with that I can control my blends. I already managed to control the blends with the raspberry using aircontrol. Therefore I need to type "sudo aircontrol -t blends_up" in the raspberry command line and press enter. The blends go up afterwards.
The app I'm searching for should send a "signal" to the raspberry that the raspberry should execute this (sudo aircontrol -t blends_up) command.
Let's say a remote app, and when pressing buttons on the remote, it should send "sudo aircontrol -t blends_up" to the raspberry.
I didn't find anything like that yet. Is this even possible with zwave?

I'm really looking forward for your answers and help.
Markus96
Posts: 9
Joined: 29 Jul 2016 11:04

Re: Sending command to raspberry

Post by Markus96 »

To make it a bit easier: Is it possible to execute a script when pressing a button with zwave or extesions like openremote or smth?
Thanks.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Sending command to raspberry

Post by pz1 »

Just as an example:
In Home automation I made with App codedDevice a toggleButton device that switches my StellaZ in heating modus with just a little bit of javascript:

Code: Select all

zway.devices[15].ThermostatMode.Set(1)
Within OpenRemote I made a command that remotely sends usingApp OpenRemoteHelper

Code: Select all

http://quadras:8083/OpenRemote/ThermostatSetMode/15/1
In OpenRemote designer it is easy to create a button that bind to the OR command. Within App codeDevice you can place any JS that suits you.
There are a number of other Apps (e.g. Http, XML, etc) that similarly create a virtual device for you.

See Recipes section for further pointers to interaction with openRemote
Markus96
Posts: 9
Joined: 29 Jul 2016 11:04

Re: Sending command to raspberry

Post by Markus96 »

I'm not sure if this is what I'm searching for...

I want the raspberry to execute a script/command when I press a button via zwave. Is this possible?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Sending command to raspberry

Post by pz1 »

I tried to guess what you meant :)
Do you mean press a button on a physical Z-Wave device such as a switch?
Markus96
Posts: 9
Joined: 29 Jul 2016 11:04

Re: Sending command to raspberry

Post by Markus96 »

Yes - and when pressing a switch/button I want the raspberry to execute a command ("sudo aircontrol -t blends_up").
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Sending command to raspberry

Post by pz1 »

With App Load custom JavaScript code you can make a virtual device that will send your command:

Code: Select all

system("sudo aircontrol -t blends_up")
Next in the App If -> Then you can set the IF part "Zwave switch = on" and the THEN part to the script code.

Finally you must set permission for ZWay to excute aircontrol. Therefore enter the full path + name of that command in file /opt/z-way-server/automation/.syscommands

See the Developers manual for further detail

Update 20160808: Following PoltoS' comment on the next page I added encapsulating in "" to the command.
Since 29-12-2016 I am no longer a moderator for this forum
Markus96
Posts: 9
Joined: 29 Jul 2016 11:04

Re: Sending command to raspberry

Post by Markus96 »

Hey, thanks for your help - I really appreciate that.

But I'm still not able to do it.


The app custom JavaScript:

That means i need to create a virtual device in the .js file or what? Does this file need to start with the html tags or just the <script> tag? And can you tell me where to find the developers manual or links to pages that I need? I really have no idea. Thank you for you patience.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Sending command to raspberry

Post by pz1 »

Sorry, I made a mistake. I should have mentioned App Code Device instead of Load custom Javascript.
Click on image below to see full configuration. Hope this helps
Capture.PNG
Capture.PNG (31.26 KiB) Viewed 9937 times
PS: Developers documentation can be found in the righthand column of this page: http://razberry.zwave.me/index.php?id=24
Markus96
Posts: 9
Joined: 29 Jul 2016 11:04

Re: Sending command to raspberry

Post by Markus96 »

Thanks!
I'm not at home to see if it works now - but one more question:

I have like 20 different commands (sudo aircontrol -t blends1_up ; blends2_up ....) to controll every blend in the flat - is it possible to combine it into one "code-device" and then create 20 buttons?
Post Reply