I already raised the question over in the Grafana community, but they recommended to ask here. Since it is mainly a question about the right query that makes probably sense.
I have a rain sensor that sends every 10 minutes the total amount of rain fall it has seen.
I do some calculations and write the amount of rain fall (in mm, which is 1l rain per m²) between the last sensor reading and the current reading in an InfluxDB database.
Now I try to show in a time series panel the amount of fallen rain per hour at each point in time. I’m using InfluxQL as query language.
Perfect would be a data point at each sensor reading.
Example:
- sensor sends data at 14:13 → plot a point in the time series panel that shows amount of rainfall between 13:13 and 14:13.
- sensor sends next data at 14:23 → plot a point in the time series panel that shows amount of rainfall between 13:23 and 14:23.
- and so on
It would be also acceptable to have the amount of rain fall between fixed 10 minutes intervals.
Example:
- independent from actual sensor readings at 14:10 → plot a point in the time series panel that shows amount of rainfall between 13:10 and 14:10.
- at 14:20 → plot a point in the time series panel that shows amount of rainfall between 13:20 and 14:20.
- at 14:30 → plot a point in the time series panel that shows amount of rainfall between 13:30 and 14:30.
- and so on
I had lengthy discussions with ChatGPT but in the end we turned in circles .
All I could achieve is a datapoint each hour.
Example:
- independent from actual sensor readings at 14:00 → plot a point in the time series panel that shows amount of rainfall between 13:00 and 14:00.
- at 15:00 → plot a point in the time series panel that shows amount of rainfall between 14:00 and 15:00.
- at 16:00 → plot a point in the time series panel that shows amount of rainfall between 15:00 and 16:00.
- and so on
The related query is:
SELECT sum("RainCorrDiff") FROM "coop_garden_calcv" WHERE $timeFilter GROUP BY time(1h) fill(null)
Alternatively I managed to have a point each 10 min (though not related to the time of the actual sensor reading) - but then the graph shows only data from the last hour. No older data are shown .
The query is:
SELECT
SUM("RainCorrDiff") AS "Regenmenge_pro_Stunde"
FROM (SELECT "RainCorrDiff" FROM "coop_garden_calcv" WHERE time >= now() - 1h)
WHERE time >= now() -1h AND time < now()
GROUP BY time(10m)
InfluxDB version 2.7.10
Grafana version: 11.1.1
Do you have any ideas what would be the correct way to achieve what I want?
Thanks
Christian