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

Ability to set write precision without sending timestamp #201

Closed Hello1024 closed 2 years ago

Hello1024 commented 2 years ago

Proposal: The influx API allows write precision to be specified (by precision=s in the /write api call URL), while not specifying a timestamp. The server uses its timestamp, but rounded to the nearest second.

Current behavior: Currently this library doesn't support this - you must either not send timestamps or precision, or send both.

Desired behavior: Have a new write option to "UseServerTimestamp(bool)", which defaults to false (current behaviour), but can be set to true to leave timestamps out.

Use case: When the server doesn't want to waste storage (timestamps use far more storage then actual data in the default config), but also the client doesn't have an accurate clock (common on embedded devices).

vlastahajek commented 2 years ago

@Hello1024, good idea, thanks.