I wish to deploy sensor nodes that publish sensor data to a central MQTT Broker and then send this information to InfluxDB.
Adding metadata to the Sensor nodes whilst publishing information to the broker. This requirement comes in lieu as the sensor nodes will be deployed in specific rooms and these information needs to be saved in the InfluxDB as
tags which can help me for post processing.
Scenario simplified as below.
measurement: sensors type: temperature, humidity location: GATEA
This metadata can be used as a query as follows:
SELECT * FROM "sensors" WHERE "type"='humidity' AND "location"='GATEA' LIMIT 100
The above mentioned query provides me all humidity sensor values coming from GateA.
How does one add such metadata when publishing information with standard MQTT?
Initial Understanding suggests:
Gateswhere each sensor nodes publish information to specific gate topic like
GATEBetc. I am not sure if this makes sense as then the InfluxDB might take the topic as a measurement and the query might look like:
SELECT * FROM "GATEA" LIMIT 100
however this does not address the
typetag that could be pushed as metadata.
Vice versa would be topic creation based on
typeof sensors e.g.
humidityfor each sensor nodes
Is there any standard practice or architecture design advice for MQTT deployment in such scenarios? Or any advice as to what path should be selected in the context of this scenario?
MQTT, Docker, Grafana, InfluxDB, ESP32 Blog Post is a great blog post which I would like to start as a base point for such a setup