Using a Vera Edge as a network-attached zwave device (skipping the vera software)

  1. By doing the above, you’re not using vera software anymore, just the hardware. There is no json, it’s like installing home assistant on Vera and replacing the whole software stack. Anything home assistant can’t handle won’t work.

  2. The instructions above will work for a test-run, they are not meant to be a permanent change. Rebooting the Vera will turn it back to its original state.
    I’m working on a couple of scripts to allow a semi-permanent switch at any time. I plan to install the scripts on 3 Veras to cover a larger installation (large as in large area; there are too few devices to have reliable mesh).

  3. If you have a tool that works with zwave serial connection, it will work with this. All this does is present to any software a remote network-connected zwave chip as a local one (you can imagine it as a fake usb zwave chip)

Have you been able to work on those scripts? I’ve done an initial test run and it seems to work well

@quasar66
I am having trouble with this, killing the processes in Vera doesnt seem to do anything. I use

kill -9 2

for example but when i ps aux the PID 2 is still there, am i missing something?

2 does not look like a correct process id, it should be something higher (at least 100, if not more, I get 400+ for process id’s.

The scripts are 90% done, maybe I should publish them as they are right now (due to some time constraints I haven’t been able to finish them).

I see, it shows up when i ps aux tho so i tried to kill it.

I’d be glad if you could post them, then i can help you test it as i cant quite get it to work myself

Created a docker image for the home assistant part:

Got time to play with this (again) so here is a more “detailed” instruction list…

connect via ssh with root / password (find it on the bottom of the unit)

run:
opkg update

run:
opkg install nano ser2net

now let’s disable auto starting stuff…

run:
crontab -e
then:

pres “i” to enter editor mode then use arrow keys to put the promopt before 1st and third line and put a # in front, then press escape (without commas)

i, #, down, down, #, esc

it should look like

#*/1 * * * * /usr/bin/Rotate_Logs.sh #Rotate_Logs

#20 02 * * * //usr/bin/mios-service-sync_ergy.sh #Sync_Ergy

^- notice the # at the start of the line

to save modifications, press (without commas)

:,w,q,[enter]

Now lets edit a bash file so it does not do anything…

cp /usr/bin/Start_LuaUPnP.sh /usr/bin/Start_LuaUPnP.sh
nano /usr/bin/Start_LuaUPnP.sh

now write the text so it looks like this at the start:

#!/bin/sh

sleep 120
exit

now press [control+o] then [control+w] to save

do the same with:
/usr/bin/Start_serproxy.sh

now let’s create a new file with

nano ~/check.sh

with contents:

COUNT=$( netstat -a | grep -i listen | grep -i "0.0.0.0:7676" | wc -l )
echo "Found $COUNT"
if [ "$COUNT" == "0" ] ; then
  echo "Killing..."
  kill -9 $( pgrep -f "Start_LuaUPnP" )
  kill -9 $( pgrep -f "Start_serproxy" )
  kill -9 $( pgrep -f "serproxy" )
  kill -9 $( pgrep -f "lighttpd -f" )
  kill -9 $( pgrep -f "LuaUPnP" )
  kill -9 $( pgrep -f "/etc/cmh-ra/keys/cmh-ra-key.priv" )
  kill -9 $( pgrep -f "cmh-ra-daemon.sh" )
  kill -9 $( pgrep -f "cmh_PnP" )
  echo "Starting..."
  ser2net -C "7676:raw:0:/dev/ttyS0:115200 8DATABITS NONE 1STOPBIT"
else
  echo "Already started"
fi

Press controll+o and controll+w to save it.
Now run
chmod +x check.sh

We can run it with
./check.sh

It will say somehting like
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Found 0
Killing…
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
Starting…

If we run it again…
./check.sh

netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Found 0
Killing...
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
ash: you need to specify whom to kill
Starting...
root@MiOS_45103975:~#
root@MiOS_45103975:~#
root@MiOS_45103975:~#
root@MiOS_45103975:~# ./check.sh
netstat: /proc/net/tcp6: No such file or directory
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Found 1
Already started

All ok!

Now let’s edit crontab to make this run every minute so our port is always exposed if vera restarts…

nano /etc/crontabs/root

and add the line

*/1 * * * * /root/check.sh

^- this means every minute, change to something else if you want…

then control+o then control+w

the reboot with

reboot

now after reboot reconnect with ssh and only run

netstat -a | grep -i listen | grep "7676"

and after 1-2 minutes you should see a line with

tcp 0 0 0.0.0.0:7676 0.0.0.0:* LISTEN

this means all is working fine!

so even if it reboots, vera will restart the tcp server for the zwave chip

Enjoy!

Wow man thanks a bunch! I’ll try this out in the coming weeks, currently abroad.

Just tried it. Thank you for sharing the scripts, it works, and it is much more interesting than configuring ZWave with Vera UI. Once you bypass Vera you have much more control over ZWave :slight_smile:

I had to add “unlink-close=0” to the socat options otherwise for me it removed the /dev/zwavevera device when the TCP connection was timing out (or closed by Vera).

If you have an idea on how to encrypt this traffic - please please share it. I wouldn’t like any device on my wifi to now be capable of sniffing ZWave traffic.

Block port 7676 with firewall from lan on vera.

From hass container / vm / server do a ssh with reverse port forward - forward remote (vera) 127.0.0.1:7676 to local (hass environment) 127.0.0.1

Modify socat to use 127.0.0.1

Encrypted zwave communications!

On second thought: start ser2net with 127.0.0.1,7676:raw: … instead of 7676:raw … no firwall changes needed!

How does home-assistant cope with /dev/zwavevera not working but still existing then working again when connection is recreated?

I went the other way - once the connection/file is missing, restart everything - see the files in this folder:

Not good. I’m not giving up yet and still experimenting. For me Vera drops the connection without any apparent reason like every hour or so, and in most of these cases all ZWave devices in HA become unresponsive. Restarting everything will work but doing it every hour does not seem acceptable.

BTW forwarding it to localhost might help. Will give it a try, too. Thank you!

Every hour or so ? Sound like a cron job… are you sure you edited the crontab ? I’m running an older firmware versions on my edge - newer firmwares / other vera models might have different scritps…

crontab -e 

or

nano /etc/crontab/<something>

then do

ps aux 

to see what’s running from time to time and add them to the kill-list
also, if you want an “auto-refresh” process list try

watch -n <seconds> ps aux

As far as I know, resetting Vera to defaults still works if you keep the reset button pressed at boot - so if you don’t go really crazy deleting files / stopping processes in the worst case you’ll have to recover from backup…

I think I fixed it. 12 hours of uptime with no reboot. Here’s the solution if anybody will have similar problems.

My configuration: Vera Plus, UI7, firmware: “1.7.3798”, zwave_version : “6.1”, no 3rd party plugins/apps.

Vera rebooted itself exactly every 1 hour 1 minute. The service responsible for the reboot was NetworkMonitor; to disable it I had to edit /usr/bin/Start_NetworkMonitor.sh (in the same way as the other two scripts mentioned at the beginning of the thread):

sleep 120
exit

Just in case I also edited out in the same way StreamingTunnelsManager.sh although it might not have been necessary.

Please be aware that as soon as you disable NetworkMonitor Vera servers will consider that your device is offline - which is reasonable as Vera software is no longer running on this device.

Started tinkering with this yesterday, seems to work OK so far.

@buen0s @quasar66 Just a question for you two, did you have to readd all your devices to the zwave network? My devices show in home assistant but none are functional

I left Hass running 15 minutes the first time, then write zwave config, then full restart, then another 15 minutes and a full restart - apart from a battery device everything else was working fine. But as far as I know some devices only configure themselves correctly with Hass if you add them while Hass is running…

The zwave entities are created properly, however the switch entities are created as switch.switch, switch.switch_2 etc and are not functional.

Excluding and including fixes this tho!

Thanks for the great work, happy to not have to deal with the vera ui anymore!

I had to re-include my devices. Wasn’t a big deal for me as I didn’t have too many of them.

did you have any problems with read-only files when editing /usr/bin/Start_NetworkMonitor.sh?

Some folders are mounted as read-only and even tho im root i cant edit the files under the folders, did you experience this?

The files actually are on a read-only filesystem with overlayfs on top. Just copy the file over itself (it usually works) then edit it - the copying actually makes a copy from the read-only squashfs to the read/write overlayfs.