You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# Changelog
2
2
3
+
## 1.1 (2021-05-22)
4
+
+ Supports multiple MQTT brokers
5
+
3
6
## 1.0.1 (2021-02-08)
4
7
+ Changed HomeMatic value request URL from `sysvar.cgi?ise_id` to `state.cgi?datapoint_id` such that `homematic_subscribe` can fetch any datapoint values, not just system variables.
Copy file name to clipboardExpand all lines: README.md
+71-32
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# Sensorlogger
2
2
Visit the [Sensorlogger website](https://tastyorange.de/projects/sensorlogger.htm) for a more structured documentation. (Auch auf [Deutsch](https://tastyorange.de/projekte/sensorlogger.htm) verfügbar.)
3
3
4
-
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.
4
+
Sensorlogger reads sensor data and creates statistical reports in logbook tables. It can redistribute incoming sensor values, but also statistical summary data, to multiple MQTT brokers 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 other purposes.
5
5
6
6

7
7
8
-
Supported data sources are (selected) [Tinkerforge](https://www.tinkerforge.com) 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.
8
+
Supported data sources are (selected) [Tinkerforge](https://www.tinkerforge.com) sensors and JSON structures that can be read via HTTP(s) or from local files. Additionally, you can subscribe to topics that are broadcast by MQTT brokers and read the values of system variables from a HomeMatic CCU. The values received via MQTT may also be embedded in their own JSON structures.
9
9
10
10
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.
11
11
@@ -21,11 +21,11 @@ In the following listing you see a very simple example for a logbook file. It ke
21
21
22
22
## Data accumulation and statistical summary
23
23
24
-
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.
24
+
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 MQTT brokers or to a 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.
25
25
26
26
Data can also be received via **interrupts,** for example from Tinkerforge IO bricklets or via subscriptions to MQTT topics.
27
27
28
-
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.
28
+
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 brokers or a HomeMatic CCU.
29
29
30
30
## Software requirements
31
31
@@ -87,7 +87,7 @@ If you don’t provide the path to a configuration file, Sensorlogger will look
87
87
88
88
### Sensorlogger as a service
89
89
90
-
It is recommended to run Sensorlogger with restricted privileges. The setup procedure for an automatic startup at boot time depends on the distribution. For Debian/Raspbian, I use a service file for systemd like the one shown below. It assumes that the executable file named `sensorlogger` is located in the user’s home directory at `/home/username`. I would also use this directory to store the logging information.
90
+
It is recommended to run Sensorlogger with restricted privileges. The setup procedure for an automatic startup at boot time depends on the distribution. For Debian/Raspbian, I use a service file for systemd like the one shown below. It assumes that the executable file named `sensorlogger` is located in the user’s home directory at `/home/username`. The configuration file called `config.json` is also located there in this example.
91
91
92
92
# /etc/systemd/system/sensorlogger.service
93
93
# ------------------------------------------
@@ -99,7 +99,7 @@ It is recommended to run Sensorlogger with restricted privileges. The setup proc
@@ -118,7 +118,7 @@ Further below, you will find a complete example configuration. Any Sensorlogger
118
118
119
119
+`general` is meant for general settings and remarks (you can add your own). Currently, it only specifies the global event log file for errors and warnings.
120
120
+`tinkerforge` contains the parameters for the connection to the Brick Daemon.
121
-
+`mqtt` contains the parameters for the connection to the MQTT broker.
121
+
+`mqtt` contains the parameters for connections to MQTT brokers.
122
122
+`homematic` contains the parameters for the connection to the XML-API of a HomeMatic CCU.
123
123
+`sensors` contains a description of all sensors from which data should be read. This is a JSON array that can contain an arbitrary number of sensor definition objects.
124
124
+`logbooks` defines logbook files and associated `columns`. It is also a JSON array that can contain an arbitrary number of logbook definitions and their proper columns.
@@ -167,17 +167,22 @@ Shown below is an example configuration file for the following scenario.
167
167
"system_restart_command": null
168
168
},
169
169
170
-
"mqtt": {
171
-
"comment": "Connecting and communicating with the MQTT broker.",
172
-
"host": "192.168.1.3",
173
-
"port": 1883,
174
-
"qos": 1,
175
-
"retained": false,
176
-
"connected_topic": "Sensorlogger/status",
177
-
"connected_message": "online",
178
-
"lwt_topic": "Sensorlogger/status",
179
-
"lwt_message": "offline"
180
-
},
170
+
"mqtt": [
171
+
{
172
+
"comment": "Connecting and communicating with the MQTT broker.",
173
+
"host": "192.168.1.3",
174
+
"port": 1883,
175
+
"qos": 1,
176
+
"retained": false,
177
+
"connected_topic": "Sensorlogger/status",
178
+
"connected_message": "online",
179
+
"lwt_topic": "Sensorlogger/status",
180
+
"lwt_message": "offline",
181
+
"enable_publish": true,
182
+
"enable_subscribe": true,
183
+
"topic_domain": ""
184
+
}
185
+
],
181
186
182
187
"homematic": {
183
188
"comment": "URL of your HomeMatic's XML API",
@@ -318,7 +323,7 @@ Shown below is an example configuration file for the following scenario.
318
323
319
324
## Tinkerforge settings
320
325
321
-
Currently, version 2.1.31 (2021-01-15) of the [Tinkerforge](https://www.tinkerforge.com/) C/C++ bindings are used. The following Tinkerforge Bricklets are supported. The table also lists the channel IDs if a Bricklet supports different types of measurements.
326
+
Currently, version 2.1.32 (2021-05-06) of the [Tinkerforge](https://www.tinkerforge.com/) C/C++ bindings are used. The following Tinkerforge Bricklets are supported. The table also lists the channel IDs if a Bricklet supports different types of measurements.
@@ -580,19 +585,39 @@ Only Tinkerforge IO Bricklets are currently supported as external triggers.
580
585
581
586
## MQTT settings
582
587
583
-
The general `mqtt` section is used to configure the connection parameters to the MQTT broker.
588
+
The general `mqtt` section is used to configure the parameters for the connections to the MQTT brokers. Any number of MQTT brokers can be set up. The following example shows a configuration for two separate brokers.
584
589
585
590
```
586
-
"mqtt": {
587
-
"host": "localhost",
588
-
"port": 1883,
589
-
"qos": 1,
590
-
"retained": false,
591
-
"connected_topic": "Sensorlogger/status",
592
-
"connected_message": "online",
593
-
"lwt_topic": "Sensorlogger/status",
594
-
"lwt_message": "offline"
595
-
}
591
+
"mqtt": [
592
+
{
593
+
"comment": "Configuration for Broker #1",
594
+
"host": "192.168.1.3",
595
+
"port": 1883,
596
+
"qos": 1,
597
+
"retained": false,
598
+
"connected_topic": "Sensorlogger/status",
599
+
"connected_message": "online",
600
+
"lwt_topic": "Sensorlogger/status",
601
+
"lwt_message": "offline",
602
+
"enable_publish": true,
603
+
"enable_subscribe": false,
604
+
"topic_domain": ""
605
+
},
606
+
{
607
+
"comment": "Configuration for Broker #2",
608
+
"host": "192.168.1.8",
609
+
"port": 1883,
610
+
"qos": 1,
611
+
"retained": false,
612
+
"connected_topic": "Sensorlogger/status",
613
+
"connected_message": "online",
614
+
"lwt_topic": "Sensorlogger/status",
615
+
"lwt_message": "offline",
616
+
"enable_publish": false,
617
+
"enable_subscribe": true,
618
+
"topic_domain": "House/Living_Room"
619
+
}
620
+
]
596
621
```
597
622
598
623
+`"host":` Hostname or IP address where the MQTT broker can be reached. May be omitted or set to `null` if you don’t want to configure any MQTT connection.
@@ -625,6 +650,18 @@ The general `mqtt` section is used to configure the connection parameters to the
625
650
626
651
Standard value: `null`
627
652
653
+
+`"topic_domain":` Can be used to restrict this broker to a certain set of topics. All topics that this broker handles must start with this string. This parameter can be used as a filter mask when multiple MQTT brokers are defined. If the broker should handle all topics, an empty string can be used.
654
+
655
+
Standard value: `""`
656
+
657
+
+`"enable_publish":` If set to `true`, all values that belong to the topic domain will be published to this MQTT broker. Can be set to `false` to disable publishing to this broker. The connected and LWT messages will be sent to the broker regardless of this parameter.
658
+
659
+
Standard value: `true`
660
+
661
+
+`"enable_subscribe":` If set to `true`, this MQTT broker will be used to subscribe to topics that belong to its topic domain. Can be set to `false` to disable any subscriptions for this broker.
662
+
663
+
Standard value: `true`
664
+
628
665
### MQTT sensors
629
666
630
667
```
@@ -676,7 +713,7 @@ The general `mqtt` section is used to configure the connection parameters to the
676
713
677
714
Standard value: `false`
678
715
679
-
+`"mqtt_publish":` Topic that is used to republish the received and possibly corrected sensor value via MQTT.
716
+
+`"mqtt_publish":` Topic that is used to republish the received and possibly corrected sensor value via MQTT. Cannot be the same topic as `mqtt_subscribe`.
680
717
681
718
Standard value: `null`
682
719
@@ -851,7 +888,9 @@ The `logbooks` key in the configuration file is always a JSON array that may con
851
888
]
852
889
```
853
890
854
-
+`"filename":` Specifies the path and filename where the logbook shall be saved. If set to `null`, the logbook will not be saved as a real file, but statistics will still be forwarded to an MQTT broker or HomeMatic CCU, if intended.
891
+
+`"filename":` Specifies the path and filename where the logbook shall be saved. If set to `null`, the logbook will not be saved as a real file, but statistics will still be published via MQTT or sent to the HomeMatic CCU, if intended.
892
+
893
+
Standard value: `null`
855
894
856
895
+`"cycle_time":` Duration of a measurement cycle. Please note that the cycle time should be well above the rest period (polling intervals) of the individual sensors in order to accumulate some values for the statistics to make sense. The numerical part for this parameter is set under `"value"`, its unit under `"unit"`. The following units are allowed: `"ms"`, `"s"`, `"min"`, `"h"`, `"d"`.
0 commit comments