I realise there are a couple of posts like this, but none seem to actually provide an answer.
I have a data source writing a data value every 48 seconds to InfluxDB database.
I want to sum the most recent 10 minutes worth of values.
I have the following query submitted via Node-Red
SELECT sum("diff_rain_mm") AS "sum_diff_rain_mm" FROM "telegraf"."autogen"."emon_input" WHERE time > now() - 30m GROUP BY time(10m) FILL(0)
I am deliberately doing more than 10 minutes to see what happens . Clearly the query is doing what I ask.
- The data is always returned in round 10 minute chunks whereas I want to sum the values from 17:22 → 17:32.
- It does not actually sum the points within that time range - they are 0.3 steps.
How can I achieve this?
{
"_msgid": "fae94d7a.291a1",
"query": "SELECT sum(\"diff_rain_mm\") AS \"sum_diff_rain_mm\" FROM \"telegraf\".\"autogen\".\"emon_input\" WHERE time > now() - 30m GROUP BY time(10m) FILL(0)",
"topic": "Rain",
"time": "2021-02-19T17:32:28.934Z",
"payload": [{
"time": "2021-02-19T17:00:00.000Z",
"sum_diff_rain_mm": 0
}, {
"time": "2021-02-19T17:10:00.000Z",
"sum_diff_rain_mm": 0
}, {
"time": "2021-02-19T17:20:00.000Z",
"sum_diff_rain_mm": 0
}, {
"time": "2021-02-19T17:30:00.000Z",
"sum_diff_rain_mm": 0.29999999999999893
}]
}