Looking for someone to create a node MQTT/Influx

Hi there,
I am looking for someone to create a flow suitable to receive MQTT messages and create Measurements in Influx to store the relevant data.
The MQTT will contain Topic/ID/tag/value. One Measurement per ID, Tags and measurements to be saved in Influx.

May be this can be done better than as above described. I am open to suggestions. PM me if you are interested. Thanks

You have shown the generation of a single influx record from multiple mqtt messages. How does the flow know when it has received all the mqtt messages for one record?
Can you instead send the complete set of tags and values in one mqtt message?

In addition are you sure you are using the word tag correctly? I suspect they are fields not tags.

Hi Colin, yes you are right. I meant field.

I don't think the node needs to know when one set of messages complete a record. There will be also a time difference because the time stamp will be different for each value/message. In influx there will be probably empty fields for each timestamp and only one value per record.

Yes I could send one message with all fields to complete a record but this will force me to customise each device because of the differences between them.

That is very inefficient. You should probably put everything in one measurement, with ID and what you called tag as tags and the value as the field.

I see your valid point. Then I will need some help also to review the way the MQTT is sent out from the devices.

The mqtt messages are ok. The ID and tag are in the topic and the value is there. It is about 10 minutes work to produce a flow that will send that to influx.

Thanks Colin. Probably for you expert guys it is 10 minutes. However I will need to review also the way the message is formatted on the device. So it may take a bit more time and testing.
Since I am not a coder, I still need some one to do the job for me.

Why will you need to do that?

Something like this (untested):

[{"id":"8dfd24a16e6c5681","type":"mqtt in","z":"bdd7be38.d3b55","name":"","topic":"topic/#","qos":"0","datatype":"auto","broker":"adf2dac3.b20fe8","nl":false,"rap":true,"rh":0,"inputs":0,"x":140,"y":1100,"wires":[["3404edf6b96a9e86"]]},{"id":"3404edf6b96a9e86","type":"function","z":"bdd7be38.d3b55","name":"Prepare for influx","func":"// topic is in the form sometopic/ID/tag\n// value in payload\n// split topic into parts\nconst parts = msg.topic.split(\"/\")\n// tag is in last element, ID in one before\nconst tag = parts[parts.length-1]\nconst ID = parts[parts.length-2]\n// build data for influx\nmsg.payload = [{value: msg.payload}, {ID: ID, tag: tag} ]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":1100,"wires":[["b2e1354b1b926362"]]},{"id":"b2e1354b1b926362","type":"influxdb out","z":"bdd7be38.d3b55","influxdb":"b0493664.35a528","name":"","measurement":"the_measurement","precision":"","retentionPolicy":"","database":"the_database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":620,"y":1100,"wires":[]},{"id":"adf2dac3.b20fe8","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"b0493664.35a528","type":"influxdb","hostname":"localhost","port":"8086","protocol":"http","database":"Testing","name":"","usetls":false,"tls":"ced18875.cf10b8","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true},{"id":"ced18875.cf10b8","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":true}]

Thank you Colin. Looks like you pushing me to do learn and do it myself ..:slightly_smiling_face:
I will give it a try starting from your flow. If I get into troubles I will ask for help on the general forum.
Thanks a lot.

When testing a flow such as I posted then test it without connecting to the db node first, feed it to a debug node and make sure the data looks right.

If you are going to learn about node-red then I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Thank you Colin. I will certainly watch the playlist.

I am a freelancer and can be part of this project.pls let me know if you need support.

Good day Jose,
thanks for your reply. I am busy finalising some work on the device, thereafter I will contact you to discuss the specific requirement on the server side.

Thanks for contacting me.
Regards
Felice

Please reach me at josekavunkal@gmail.com