Mqtt Graphing

(You can suggest changes to this post.)

Jul 25 , 2016

Having attended the LCA2016 OpenHardware miniconf I have an ESPlant module, and it had just sat in it’s packet since the conference in February!

I finally got it hacked together to do some data collection! I used mosquitto on my in home debian server to be the broker, which mqtt2rrd then listens on for the MQTT messages, and spits out some RRD files. Finally, drraw.cgi on my internal web server creates the graphs on the fly!

Temp, Humidity, Pressure and Voltage graphs in drraw.cgi

I’ve put it in our north facing bedroom, with the solar panel stuck on the window, so hopefully it’ll charge enough during the day to measure constantly.

I may have to look at @projectgus’ firmware that does longer sleeping.

A good afternoon’s hacking I reckon!


The standard mosqitto package on debian 7 doesn’t cope with the ESPlant’s output, so I installed from the githubrepo, and to keep things ‘easy’, moved the distro binary to a backup file, and linked /usr/local/sbin/mosqitto in to /usr/sbin. No config changes necessary!

On my web server VM, I cloned MQTT2RRD. I had to install the python-mosqitto and python-rrdtool packages, but after that it worked fine! For it’s config I’m sticking the RRD files on my NAS. I’m not sure if the ‘archives’ bit is doing what I think it is, but time will tell I suppose!

data_dir = /media/media/mqtt
pid_file = /tmp/
user = pwarren
group = pwarren

log_file = /tmp/mqtt2rrd.log
log_level = 30

client_id = "Ashpool"
hostname = ashpool.lan
port= 1883

friendly_name = "Temperature"

friendly_name = "Atmospheric Pressure"

Lastly, I installed drraw from apt, it’s config was rather simple to start with, point it to the RRD files, and get apache to serve up /cgi-bin/drraw/drraw.cgi and go nuts creating graphs and dashboards!

This site is ad-free, and all my writing can be modified and re-used under a Creative Commons Attribution 3.0 license. If you wish to support me making creative works and giving them away for free, then I welcome tips on PayPal, GitTip, Flattr, or Litecoin (Lbwnx4GoocEBbTimdQDhRhTg6mthCzBU7R).

comments powered by Disqus