tobiasschuerg / InfluxDB-Client-for-Arduino

Simple library for sending measurements to an InfluxDB with a single network request. Supports ESP8266 and ESP32.
MIT License
382 stars 95 forks source link

Help with writing in batches #220

Open hoellwerth opened 1 year ago

hoellwerth commented 1 year ago

As i could't find any contact data, I thought of just opening this issue here.

Overall I need a function which gets data its according timestamps from two arrays and then flushes everything in them into influxdb. I tried my best with the example batch code, but couldn't adapt it far enough.

Thanks for your help

vlastahajek commented 1 year ago

@Baumistlustig, you haven't specified any details about arrays. Basically, if both arrays contain related data and have the same size, you can just iterate over both in a single for loop where you will fill a Point and then immediately write this point. After the loop just call Flush() to make sure all is written.

hoellwerth commented 1 year ago

@vlastahajek Thanks for your answer. Could you maybe provide a minimal example? Thanks

vlastahajek commented 1 year ago

A minimal example is already in the SecureBatchWrite example, where there is iteration over found networks.

Post here, what you have and what doesn't work.