Sensorlogger reads sensor data and creates statistical reports in logbook tables. It can redistribute incoming sensor values, but also statistical summary data, to an MQTT broker or to a HomeMatic CCU. Its original purpose was to serve as a logger for a weather station equipped with Tinkerforge sensors, where data has to be averaged and logged every 15 minutes. However, Sensorlogger is very flexible and can be configured to serve many more purposes.
Supported data sources are (selected) Tinkerforge sensors and JSON structures that can be read via HTTP(s) or from local files. Additionally, you can subscribe to topics broadcast by an MQTT broker and read the values of system variables from a HomeMatic CCU. The values received by MQTT may also be embedded in their own JSON structures.
In the following listing you see a very simple example for a logbook file. It keeps track of the mean outside temperature and humidity every 30 minutes.
# Time Temp [°C] Humidity [%RH] 2021-01-31 15:00:00 2.79615 65.0923 2021-01-31 15:30:00 1.182 70.46 2021-01-31 16:00:00 0.90467 75.36 2021-01-31 16:30:00 0.56 75.8733 2021-01-31 17:00:00 0.0286667 80.5067 2021-01-31 17:30:00 -0.499333 84.76 2021-01-31 18:00:00 -0.926 89.06 2021-01-31 18:30:00 -1.14067 89.1933
Data accumulation and statistical summary
Sensorlogger is able to read values from Tinkerforge sensors and JSON structures in user-defined time intervals. After reading, these values can be forwarded immediately to an MQTT broker or HomeMatic CCU (the XML-API is used to set system variables using their ISE-ID). The values are also stored internally until they become irrelevant for any further statistical analysis.
Data can also be received via interrupts, for example from Tinkerforge IO bricklets or via subscriptions to MQTT topics.
Optionally, collected data can undergo statistical processing. Currently, Sensorlogger can calculate mean, median, sum, minimum, maximum, frequencies, counts and standard deviations. These are calculated for logbook columns that users can set up to their own liking in the configuration file. The statistical summary of a measurement cycle is then periodically written to a logbook file and/or broadcast to the MQTT broker or HomeMatic CCU.