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):
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 email@example.com -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:
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:
Member of zwave received update
postUpdate(OH_ZWAVEUP_LCH, new DateTimeType())
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:
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.