JeeNode to MQTT Gateway

MrMobileWill HomeAutomation, openhab 0 Comments

It’s been a few months since I have worked on openHAB but that is mostly due to focusing on FriedCircuits, Hackaday Prize and the Maker Faire. Not a dull moment around here! I finally sat down while watching some tube (or rather crystals) to start work on the JeeNode to MQTT gateway. Up to this point if you have read my other posts I have still relied on DomotiGA to get the JeeNode data into openHAB. This is because DomotiGA has support for JeeNodes. I noticed the sensor nodes weren’t checking in again which usually is because DomotiGA is not running, this time I think it just needed a restart plus one node actually needs batteries. This prompted me to finally get around to writing the gateway. Once complete I won’t need DomotiGA and the desktop UI so I can use Ubuntu server for my rebuild of openHAB.

After some research I was able to get receive the data over serial, split it and shift the bits into separate variables to publish over MQTT. Using the Paho MQTT python library it is trivial to connect and publish. I decided to map out it out as JeeNode/node#/name/value. Simple. I should mention this code is assuming the JeeNode is running the room node sketch or at least using the packet format. My remote nodes and receive node code is on Github if needed. Here is a graphical view of the tree for one node.

MQTT JeeNode Map

This turned out much easier than I had anticipated. The last thing is to clean up the code and put in some error handling so it will resume if there is an error or reconnect if disconnected from the MQTT gateway. The one error I encountered was when the JeeNode would request an acknowledgment  and the ACK crashes the python script since it is looking for an integer. This was easily solved by checking for digits after we read a line from the serial port and split the data. The final part is just updating the items in openHAB to point to the new MQTT path. For now the gateway is running from the command prompt under a screen session in the background. The code can be found on GitHub.

I hope someone finds this useful since I searched quite a bit and it seems no one else has published something like this, at least in what I could find. Minus the thermostat this screenshot shows the sensors that are using the gateway.

Sensor data from JeeNode MQTT Gateway

Leave a Reply