Asconasny wrote:...could you share how you do that? ...
...I have it up and running with ser2net, want to try out the z-wave.me software...
Sure. Note, these instructions are for an R-Pi. This won't work on a OpenWRT router like the Mango.
The basic idea is to have a shell script on the R-Pi that starts and stops the appropriate daemons. Here is the R-Pi script (I placed it in /home/pi/bin/zcontrol):
- Code: Select all
#!/bin/sh
MODE=$1
case $MODE in
local)
/etc/init.d/ser2net stop >/dev/null
/etc/init.d/zbw_connect start >/dev/null
/etc/init.d/z-way-server start >/dev/null
echo Z-Wave controller is reserved for local use
;;
remote)
/etc/init.d/ser2net start >/dev/null
/etc/init.d/zbw_connect stop >/dev/null
/etc/init.d/z-way-server stop >/dev/null
echo Z-Wave controller is reserved for local use
;;
*)
echo invalid argument. arg1 must be local or remote
exit 1
;;
esac
/usr/bin/logger -i Z-Wave controller set to $MODE mode
exit 0
Then, on the Indigo server I created two scripts (just to make things easier). These scripts use
expect so they can pass the R-Pi's root password to the R-Pi to execute the script there with the right permissions. First, to set the R-Pi to local mode. (I.e. Z-WAY mode) I named this
zlocal and it can be placed anywhere you like
- Code: Select all
#!/usr/bin/expect
log_user 0
set password "password"
eval spawn /usr/bin/ssh -q -t pi@192.168.5.139 "sudo /home/pi/bin/zcontrol local"
expect "assword:"
log_user 1
send "$password\r";
expect "closed"
exit
and the companion script to set the R-Pi to
remote (I.e. ser2net) mode is
- Code: Select all
#!/usr/bin/expect
log_user 0
set password "password"
eval spawn /usr/bin/ssh -q -t pi@192.168.5.139 "sudo /home/pi/bin/zcontrol remote"
expect "assword:"
log_user 1
send "$password\r";
expect "closed"
exit
Finally, create two Indigo Actions of type:
Server Actions ->
Script and File Actions ->
Run Shell ScriptI called mine
z switch local and
z switch remote. Click
Edit Action Settings...Enter the full path to the appropriate script.
That's it.
As to getting Z-WAY running . Once you have Z-WAY installed (which is a pain, the documentations is not well translated) the first thing you need to do is tell Z-WAY which device you have. The default is for the RaZberry at /dev/ttyAMA0. However, if you are using the UZB1, you will need to set it to /dev/tty ACM0. You can do this in the Z-WAY web interface. Click ☰ (The menu symbol) in the upper-right corner and select
Apps, then select
Z-Wave Network Access and under
Serial port to Z-Wave dongle enter the device.
BTW, if you don't want to run ser2net, there is an alternative, the built-in python rfc2217_server.py. You can execute this as:
- Code: Select all
sudo python /usr/share/doc/python-serial/examples/rfc2217_server.py -v -v -v -v -p 7000 /dev/ttyACM0
where -p is the port number. However, if you go this route, you will have to modify the zcontrol script accordingly. Starting the server is easy, just enter the line above. But, killing the server is a bit more complex. The following line seems to work
- Code: Select all
kill $(ps aux | grep 'rfc2217_server.py' |grep -v "sudo\|grep" | awk '{print $2}')