Recording the sensor readings and later the statistics read from the coffee machines was a priority from the beginning. The ideal database for this kind of data is a time series database, of which Influx is a common one. The biggest problem with this database is that it does not support MQTT, only offering its HTTP and native interface.
To fix this, a simple MQTT-to-Influx HTTP line protocol bridge was written, again using the Mosquitto client library as well as the POCO framework's HTTP functionality:
#include "mth.h" #include <iostream> using namespace std; #include <Poco/Net/HTTPRequest.h> #include <Poco/Net/HTTPResponse.h> #include <Poco/StringTokenizer.h> #include <Poco/String.h> using namespace Poco; MtH::MtH(string clientId, string host, int port, string topics, string influxHost, int influxPort, string influxDb, string influx_sec) : mosquittopp(clientId.c_str()) { this->topics = topics...