influxdb flux query for mqtt sensors

61 Views Asked by At

I've some Shelly EM sensors flushing data into InfluxDb. I've this graph for the consumptions over time made by this query:

from(bucket: "shelly-em")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)

|> filter(fn: (r) =>
    r._measurement == "payload" and
    r._field == "numValue" and
    r.sensor == "power")
   
  |> aggregateWindow(every: 5m, fn: mean, createEmpty: false)
  |> map(fn: (r) => ({ r with _value: r._value  }))

The problem here is that I've the data divided also by the channel and device tag, and this query outputs 14 curves. I need to have one single curve that's the sum of all, I'm struggling but not being able to accomplish it..

Thanks

0

There are 0 best solutions below