Share Z-wave dongle over IP (USB over IP using ser2net / socat ) guide


(Kris K) #61

Has anyone done this successfully with a Aeotec Zwave USB Stick Gen6?

I have a Vero 4K Media player which has 2 x USB2.0 ports - it would be perfect I suspect as it already runs debian.


(Miika Jukka) #62

Can’t answer you question wether it work or not but why not just try it out and report back if you were succesfull?

Here’s another topic if socat/ser2net won’t work for you.


(Kris K) #63

Thanks, im going to try and extend the Zwave first and see how that goes. Failing that, ill try a second stick and report back!


(Kris K) #64

Hi All

I got this working fine, so i thought id test it by restarting the device that shares the USB and I had to restart everything to get it to work again.
Can someone help me to define where I add restart=always? or help me to ensure that it reconnects upon either OH2 restarting or the host serving the USB?

Thanks!


(Kris K) #65

Anyone??


(Thomas Bail) #66

the restart alway should be located in the socat@.cof. See the other thread where the configuration is more in one article Forwarding of serial ans USB ports …


(Kris K) #67

It is.

The issue is that OH2 has IO errors when it restarts, forcing the restart of OH2.

Hasnt anyone experienced this?


(Thomas Bail) #68

could you post the errors? i do not experiance any problems


(Kris K) #69

It was in the other thread. But this happens when socat restarts. Only way to fix is restart OH2 which isnt ideal

06:44:40.562 [ERROR] [ding.zwave.handler.ZWaveSerialHandler] - Got I/O exception                                                        Input/output error in writeArray during sending. exiting thread.
06:44:42.571 [ERROR] [ding.zwave.handler.ZWaveSerialHandler] - Got I/O exception                                                        Input/output error in writeArray during sending. exiting thread.
06:44:54.572 [ERROR] [ding.zwave.handler.ZWaveSerialHandler] - Got I/O exception                                                        Input/output error in writeArray during sending. exiting thread.
06:44:56.579 [ERROR] [ding.zwave.handler.ZWaveSerialHandler] - Got I/O exception                                                        Input/output error in writeArray during sending. exiting thread.
06:45:08.580 [ERROR] [ding.zwave.handler.ZWaveSerialHandler] - Got I/O exception                                                        Input/output error in writeArray during sending. exiting thread.
06:45:10.490 [INFO ] [smarthome.event.ItemStateChangedEvent] - OpenHAB_Cpu_Load1                                                        changed from 0.1 to 0.3
06:45:10.497 [INFO ] [smarthome.event.ItemStateChangedEvent] - OpenHAB_Cpu_Load5                                                        changed from 0.2 to 0.3
06:45:10.502 [INFO ] [smarthome.event.ItemStateChangedEvent] - OpenHAB_Sensors_C                                                       puTemperature changed from 30.0 to 29.0
06:45:10.507 [INFO ] [smarthome.event.ItemStateChangedEvent] - OpenHAB_Cpu_Load                                                        changed from 2.6 to 2.4
06:45:10.589 [ERROR] [ding.zwave.handler.ZWaveSerialHandler] - Got I/O exception          

(Roel) #70

Just a quick reply as i’m currently at work, but it should suffice to just restart the Zwave binding instead of Openhab.

I would have to check tonight to be absolutely sure but in my install i can restart the the remote Z-wave node without running into issues in Openhab at all. It does depend on the time it takes to restart though.


(vossivossi) #71

Yes, a restart of the Zwave binding does the job, no need to restart OH. I have implemented a command with Exec binding to automate this by logging in to Karaf console and then execute

bundle:restart org.openhab.binding.zwave

(Kris K) #72

Thanks. Yeah ideally i shouldnt have to restart at all but a binding restart helps a little. I have battery devices that need a wake up if thr binding starts again or they fail to work (motion sensor)
Be keen to know what your oh2 instance does…


(Roel) #73

My Zwave devices never fail if i restart the zwave binding. Devices only go offline is a wake up event in Zwave is missed by Openhab.

So if you restart the zwave binding and a device would send an wake up event during that time… the device most likely goes offline in Openhab. This should recover once the next wake up event is received.

The above should not influence the workings of a battery operated device. motion sensors, temp sensors, door sensors… they all keep sending the on/off events and updates…


(Kris K) #74

Odd. My other sensors work fine after a restart my motion one doesnt . Ill test it a but more anyway


(Kris K) #75

So you’re right, a restart will place the battery device in ‘REQUEST NIF’ until it wakes up but the sensor still operates with the rules etc which is good.

Now to work out why I need to restart to fix the IO ERROR seen in the OpenHab console when socat restarts or ser2net is lost.


(Kris K) #76

Can you shar your rule for doing this please?


(vossivossi) #77

Yes, of course. However I have to say that I am running OH on Windows so my solution might not be suitable 1:1 for other configurations.

So basically I created a “zwaverestart”- thing for the excec binding (which you need to install in OH):

/*exec*/
Thing exec:command:zwaverestart "Command: zwaverestart" [command="restartzwave.bat", interval=0, timeout=20, autorun=false]

This “thing” calls an executable batch file “restartzwave.bat” on the command line level (this is of course Windows specific). I did this after many tries as I was not able to put the complete command line successfully in the thing. So the file restartzwave.bat has this content:

plink  openhab@127.0.0.1 -P 8101 -pw habopen -m c:\zwave\bundle.txt

This is the call of Karaf Console via SSH (in Windows done with plink (a Open SSH implemenation for Widnows), which needs to be installed first), here with the default password “habopen” and the command itself is again in another text file (C:\zwave\bundle.txt). Again I did this hack with the second file because I was not able to get it to run with the command text directly in the same line (might also be a Windows specific problem).

So finally, in the file bundle.txt I have the command for Karaf console:

bundle:restart org.openhab.binding.zwave

Hopefully this helps you to get further.

However, there is one more important point: How do you know that the rule needs to be fired? How do you know that your Z-Wave controller actually seems to be offline? I implemented this in the following way:
All my Z-Wave based items are members of the same group ZWAVE. Whenever one of the members receives an update the controller must be still be working. So I defined an item OH_ZWAVEUP_LCH to store the last timestamp when a Z-Wave item was updated:

rule "MemberUpdatezwave"
when
    Member of zwave received update
then
       postUpdate(OH_ZWAVEUP_LCH, new DateTimeType())	
end

I have a then a time based cron rule every 15 minutes which checks if the last timestamp of Zwave updates is older than 15 minutes. If this is the case, I send the command for the excec thing to trigger:

sendCommand(RESTARTZW, ON)

I know that this is a bit complicated and there might be of course other ways to implement it. But for me it works very reliable for more than a year now. Since I have this setup I do not worry about a lost USB-IP connection as it only affects my system for 15 minutes, then the Z-Wave binding restarts and everything works again.


(zolakk) #78

I suspect it’s the binding itself that has a problem with the loss of the serial port. I’m not sure if a recovery from that is built in or possible if not, @chris should be able to answer that.


(Chris Jackson) #79

No - there is no recovery from a serial port failure - if the port is not reliable, then there will be a problem.


(Kris K) #80

Understood. So how are people getting around this, just restarting the binding?

It would be great if the binding could have some kind of timer to retry…