Publishing data to MQTT

I wanted to get the data from my AutoPi dongle to a second computer in my car (as well as into an InfluxDB database in my home), and wrote a service, cache and returner to do so. In case it might be useful for others as well, I have published it on GitHub at topeju/autopi_mqtt.

This set of custom code can be used to replace the built-in cloud returner (mostly because my car is really old and only able to handle 10 OBD-II queries per second): in addition to publishing the data to an MQTT broker, it also publishes it to the AutoPi cloud.

Note that at the moment, the MQTT broker connection information needs to be edited by hand into one of the files, because I haven’t yet figured out how Salt configurations can be used.

What this system allows me to do is have that second computer display a dashboard with current car data. I do this with Node-RED, and my dashboard currently looks like this (the car has been off since last night so the data shown here isn’t very informative):

(I’m pretty sure I could just use the AutoPi dongle to display that dashboard, but I wanted a bit more power so that’s why I added a second Raspberry Pi 4 in the car. My idea is that I would also add a rear-view camera to the RPi4 at some point.)