This connector is a middleware between the main LoRa gateway receiving radio messages from meshed sensor stations and the time series database used for further data analysis and visualization. It does not in itself modify the data in any way, shape or form and neither does it process anything else stored in the database.
Data read from the MQTT queue acts as the input to the connector, and gets saved in the InfluxDB database.
Messages should be pushed into the MQTT queue in a JSON format specified below.
{
"time": DateTime<Utc>,
"sensor_id": i16,
"temperature": i16,
"humidity": u8,
"pressure": u16,
(disabled) "raw_gas_resistance": Option<u32>
}
Sensor reading representation, as present in the InfluxDB database. Every record is saved in the format specified below.
In brackets, on the very right of each field, are contained the constraints of processed variables. The processing is not being done by this module, but is rather left to the data analysis and visualization part of the project.
# Schema:
[DateTime] "date_time": date, time and timezone in ISO 8601 format
[i16] "sensor_id": unique identifier of the sensor from which the reading was sent
[i16] "temperature": value * 10^2, [+/- 1°C variance (range: -40°C to 85°C)]
[u8] "humidity": value, [+/- 3% variance (range: 0% to 100%)]
[u16] "pressure": value * 10, [+/- 1 hPa variance (range: 300 hPa to 1100 hPa)]
[u32] (disabled) "raw_gas_resistance": raw format, in Ohms
INFLUXDB_ADDRESS=[database address]
INFLUXDB_DATABASE_NAME=[database name]
INFLUXDB_TOKEN=[influxdb api token]
MQTT_CLIENT_ID=[mqtt unique client id]
MQTT_BROKER_URL=[mqtt broker url]
MQTT_BROKER_PORT=[mqtt broker port]
RUST_LOG=[logging level (see below)]
Library used for logging: https://docs.rs/log/latest/log/
Setup and startup logs are at the info
level. Message contents are available at debug
.
TL;DR: selecting a log level disables all levels below it (selecting info
disables debug
and trace
logs, etc.).
Available log levels (specified as a crate feature):
off
error
warn
info
debug
trace