Sensorlogger
Measurements from JSON structures
JSON structures can be read from files or via HTTP(s) to serve as a source for sensor values. To define such a sensor, the path (or URL) of the JSON file must be provided, as well as the complete key sequence within the JSON tree to access the value.
"sensors": [ ... { "sensor_id": "Sensor/JSONTemp", "json_file": "/home/user/weather.json", "json_key": ["Weather", "Temperature"], "factor": 1, "offset": 0, "mqtt_publish": "House/Weather/Temperature/current", "homematic_publish": "12345", "rest_period": {"value": 5, "unit": "s"}, "retry_time": {"value": 2, "unit": "s"} }, ... ]
"sensor_id": General, unique ID for the sensor that will later be referenced when defining statistics and logbooks.
"json_file": Path to the JSON file that will be read periodically. This can be a location on the local file system, or a URL that is accessible via HTTP(s).
"json_key": The value’s key sequence on the JSON tree. To identify a key on the upper level, a simple string identifying the key’s name is enough. To reach deeper levels, you need to provide an array of key identifiers. If you need to access elements within JSON arrays, provide an integer number to specify the position within the array (note that indexing starts at 0).
"factor": Correction factor, see next point.
Standard value: 1
"offset": Correction offset. The resulting sensor value is then calculated from factor·(measurement+offset).
Standard value: 0
"mqtt_publish": Topic that is used to publish the polled and possibly corrected sensor value via MQTT.
Standard value: null
"homematic_publish": ISE ID of the HomeMatic system variable that should be set to the polled and possibly corrected sensor value.
Standard value: null
"counter": Specifies if this sensor is a pure counter. In this case, the variable must be set to true. This means that no measurement value is kept in the data storage, but all messages are counted. For logbook statistics, it will only be possible to evaluate the number of measurements and their frequency, but none of the other statistical operations (such as mean) will give any meaningful results. If a sensor is polled very often, it can save memory not to keep all measurements of a measurement cycle if the intention is for example to only forward them via MQTT, or if this sensor acts as an event counter.
Note that measurements are always counted, irrespective of this configuration parameter. You will always be able to evaluate count and frequency when running the statistical analysis.
Standard value: false
"rest_period": Time for the sensor to rest between two measurements. The JSON file is polled again after the rest period has passed. The numerical part for this parameter is set under "value", its unit under "unit". The following units are allowed: "ms", "s", "min", "h", "d".
Standard value: default_rest_period, minimum: 100 ms
"retry_time": When the sensor reading fails, the following attempt to read the sensor is made after the retry time (if it is shorter than the sensor’s rest period). The numerical part for this parameter is set under "value", its unit under "unit". The following units are allowed: "ms", "s", "min", "h", "d".
Standard value: default_retry_time, minimum: 100 ms