Send retarded data to InfluxDB


I am using several mkr 1010 Arduinos connected to some sensors (mkr env Shield and seeedstudio grove sensors), and send the measured data (for example every 3 minutes), vía MQTT to a RPI with NodeRed, Grafana and InfluxDB.

If everything works, it's fine. But, because of the weak WiFi signal, or too many clients are connected to one WiFi-antenna, the arduino gets disconnected, and after some time, the WiFi signal gets strong, and the arduino connects to it.

I would like to know, if I can publish data in InfluxDB using NodeRed, that is retarded (for example 10 minutes too late). It would send in the message the amount of time it's too.

Can InfluxDB handle with it, and the retarded time? I would like to avoid in the DataBase an extra column with the lag time.

Yes, InfluxDB will allow you to specify the timestamp of the record. Normally you don't because you are sending pretty much in real-time but you can certainly send it.

However, you will also need to think about caching of data. So you will want to auto-cache and replay in order only if online. You will also need to think about available cache space.


But how can I do it from NodeRed? Inside the arduinos, there is no problem. I can catch the moment when I loose the WiFi connection, store the measurement values, i order to send them. But how can I achive to tell influxDB that the data is out of time? Now I only add the payload to InfluxDB (as a JSon-Obj). Timestep is autocatically added.

The influx batch node allows specifying a timestamp. Not sure whether the basic influx node does.

Ok. Reading the help of the batch node:

The measurement property of a point contains the name of the measurement for the point. The fields property will contain the fields of the point. If supplied, the tags property will contain the tags for the point. To set the time for the point, supply a timestamp property.

Do you have any example? How should I modify my payload? Now, my payload is quite simple (like: {"temp":23.25919,"sensorID":1,"hum":54.15326,"pressure":101.0474,"illuminance":33.87097,"uva":0,"uvb":0,"uvIndex":0} )

Thanks :slight_smile:

You don't need a node to write to InfluxDB. Have a look at the API, it is really easy to use and you can call it using just an HTTP request node. Then you can do whatever you like.

Read the info tab carefully, it tells you how to structure the data, but you do need to read it carefully and make sure you understand what it means. Without going and looking myself I do not remember exactly what the format is. Once you work out what it needs then if you don't know how to get the data into that format then ask again, explaining what structure you need.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.