Pico Enviro & InfluxDB: Time of insertion is displayed on grafana instead of time of recording

I recently followed a very helpful tutorial to set up my Pico Enviro Grow kit. I can know read data and store it on an InfluxDB running on another rpi. I never used InfluxDB before and am exploring its capabilities. It works very well with grafana. However, I have one challenge. My pico collects data every 15 minutes and transfers the data to influxdb every 10 readings. So by the time the the data is transferred there are multiple readings. When this data is inserted to influx, however, all readings (e.f. Temperature recorded 10 times at 15 min intervals) seem to share the same timestamp, which is the time of insertion. I only followed the provisioning of Enviro Grow and choose InfluxDB. Is there a way to reflect the timestamps of actual recordings instead of the time of insertion?

Here is the tutorial I followed: Enviro (Pico W Aboard) and InfluxDB

I think this bug’s been fixed but it’s not made it into a release yet - if you find the line in your enviro/destinations/influxdb.py that says:

payload += f"{key},device={nickname} value={value}"

and change it to

payload += f"{key},device={nickname} value={value} {timestamp}"

then the timestamps should behave themselves.

1 Like

This solves it, perfect. Many thanks!

1 Like