Hi,
I am an electrician and gas installer by trade. I am a complete noob to programing and see that I need to evolve with the times and venturing into the remote monitoring space.
I have been able to so far, with the help of google and youtube set up on Digital ocean Mosquito MQTT, Node Red, Influx DB and Grafana.
I have a device that where I am collecting data over GSM via MQTT topics from 3 x temp probes and 2 x current transformers, as well as some other data of the monitoring device, such as signal strength, tilt switch, power ect...
I have set up some flows in Node Red to set up some email alerts and currently using the built in Node Red dashboard for testing proposes.
I am now at the point where I would like to get the data stored in Influx DB and create dashboard in Grafana linked to the Influx DB database set up for this device.
I understand that I use the Node Red Influx DB node to store the data in the created Influx DB database created for this device eg: "Gas Boiler 1"
This is the point where I am stuck.
What I understand is that I need to use a function node in Node Red to convert the data (payload) collected in Node Red from the MQTT node, so that the data can be stored correctly in the database created for this device in Influx DB.
The device publishes the topics for each sensor every 60 seconds, and other data of the monitoring device which on gets published at state change, via MQTT. I am using an MQTT node for each topic to collect the data and sensor reading (payload).
For example, the topic for the sensors is:
/eontec/model1/temperature/temp1
/eontec/model1/temperature/temp2
/eontec/model1/temperature/temp3
/eontec/model1/currentsensor/ct1
/eontec/model1/currentsensor/ct2
-
What would be the correct code to enter into the Function Node, to convert the payload (sensor reading) into the correct format to be stored in influx DB in the created database "Gas Boiler 1" for each sensor?
-
In the Influx DB Out node, in the server settings properties tab, I enter the server details and enter the database eg "Gas Boiler 1" I would like the reading to be saved in. On the DB Out node properties tab, in the measurement field, do I insert which sensor the reading is from, eg: temp 1?