Temperature monitoring with Node-RED

I originally wrote my temperature monitoring software using Python, and while my Python solution works (almost) flawlessly, I recently became aware of Node-RED, a project initiated at IBM, meant as a controller for the Internet of things.

When i read about Node-RED i wanted to try it out, so i decided to port my temperature/surveillance monitoring solution from python to Node-RED, and while i’m not much of a JavaScript fan, it actually worked out rather well.

Installing went fairly smooth. The node-RED website has very thorough instructions on how to install it on a Raspberry Pi, along with instructions on how to make it run as a daemon every time you reboot your server.

I managed to port 2 weeks of python coding to Node-RED in roughly 8 hours.

Node-Red implementation

Everything is done and configured in the browser Node-Red editor

Despite a few hiccups - me relearning JavaScript for one - it’s been running fairly stable now for a couple of months. My main problem was getting used to the asynchronous ways of Node, especially when trying to get things done with a SQLite3 database.

There are still a few things that could work better.

MQTT connections are sometimes dropped without any errors, in fact the logs displays it as connected, and my primitive solution is a canary message on the MQTT broker and a python(sigh) script to restart my node-RED instance whenever the canary fails to sing for a given timeperiod.

A fatal error in a function will cause Node-RED to crash, and since i run it in a Docker container, it makes it rather difficult to get the image back up and running again when it crashes every time it is launched.

The above issues prevent me from migrating my solution completely, but i’ll keep it running as a “Proof of Concept” for now, and have something useful to try out new releases with.

comments powered by Disqus