I hope here there is somebody expert of Influxdb V2…
I have a bucket (homeassistant
) that collects info from a temperature / humidity sensor.
Of course, I want to downsample his data to min/max/mean of previous day.
Inspired by this post, I created a new bucket downsample
and two tasks for the moment:
option task = {name: "BALCONE_MAX", cron: "0 0 * * *"}
option v = {timeRangeStart: -1d, timeRangeStop: now()}
from(bucket: "homeassistant")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r.entity_id == "0x00158d00067beedf_temperature")
|> filter(fn: (r) => r["_field"] == "value")
|> aggregateWindow(every: 24h, fn: max, createEmpty: false)
|> yield(name: "max")
|> to(bucket: "downsample", org: "sineverba")
And
option task = {name: "BALCONE_MIN", cron: "0 0 * * *"}
option v = {timeRangeStart: -1d, timeRangeStop: now()}
from(bucket: "homeassistant")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r.entity_id == "0x00158d00067beedf_temperature")
|> filter(fn: (r) => r["_field"] == "value")
|> aggregateWindow(every: 24h, fn: min, createEmpty: false)
|> yield(name: "min")
|> to(bucket: "downsample", org: "sineverba")
They run both at 00:00 and save min and max in same bucket.
But today I checked and… I have only a single point (only the min value, in reality), not the max.
Is it possible to save both value inside same bucket?