Debugging Z-Wave in openHAB
I’ve been running openHAB as my home automation software for a few years now and recently I had to resolve some issues with Z-Wave devices. In order to do that I had to enable debugging in openHAB.
In a previous post, I documented how I run openHAB in Docker and in the process of setting up all the devices I had to dive a little deeper this time around. The documentation was accurate but it still took a bit to figure out the steps I needed so instead, I’ll log them here in case I need to do this again in the future.
Runtime Config
In order to be able to log into the console, I had to allow the port to be connected to. This was a simple as adding/uncommenting the line in ./conf/services/runtime.cfg:
org.apache.karaf.shell:sshHost = 0.0.0.0
I had to do this since I’m not connecting to it from localhost but instead from the docker host. The container didn’t have ssh installed on it so I couldn’t use a docker exec...
type of command to get in.
Restart the container.
Connect to Console
Docker will assign containers IP addresses from a different subnet so if your host IP is something like 192.168.1.X, the openHAB container will not be in that subnet but instead something like 172.19.0.2. To find out the IP address of the container you can use docker ps
and docker inspect
to find out. I know the container name is openhab-openhab-1 so I can just run the following to connect:
OH_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' openhab-openhab-1)
ssh -p 8101 openhab@$OH_IP
The default username/password is openhab:habopen, so enter habopen
at the password prompt.
To disconnect, hit ctrl+d.
Enable Z-Wave debugging
From the openHAB console run the following command to enable Z-Wave debug level log messages:
log:set DEBUG org.openhab.binding.zwave
To disable, run the following:
log:set INFO org.openhab.binding.zwave
These are the same instructions available in the official documentation .