As part of my Coffee In Coffee Out project, I needed a gateway to take the data from the Moteinos and push it up to the internet. I started out with some kludged scripts that mostly worked just fine. But they had some oddness since they were very blocking and single threaded. Plus I wasn’t thrilled to try and build up something new where I knew there had to be a bunch of prior work. Given the choice, I’d rather build upon the bugs others have solved, than to re-solve them myself.
So I went hunting for a IoT gateway project. There were a few choices, but I don’t remember the others. Since once I came across Node-RED I knew I found what I wanted. It wasn’t without some missing parts, but they were small and allowed me to give a little back.
The first piece was to create a node that would write (or read) from Exosite. It was fun to dive into the way Node-RED works and do a little more with Node.js. The resulting node-red-node-exosite can be installed with npm, and the source is on github.
Node-RED is pretty easy to install on your desktop and start playing with it. Getting it install on a BeagleBone is also quite easy. Getting it setup to run from an init.d script was a few extra steps. It would be an incredible improvement if Node-RED had a .deb to install with. This gist helped getting that process started, but I had some changed that were specific to my setup.
With that in place, I built up the flow to get data from the UART over to Exosite.
(Fern is the other Moteino I have that is collecting Temperature, Humidity and Lux.)
It took two small script functions to twist the data around. The first to convert the lines from the UART into objects, and the second to build the alias to value map that Exosite uses.