Hi, I have a sensor that measures a volume in litres. At 100% the water level is 4 litres. The level will decrease over time and then rise again.
I want to visualize the total amount of water that has been in the tank.
In the database i have a value every 5 minutes that hat the water level percentage as integer.
So far i got this:
For the query that gives you the total, switch to the raw query editor (pencil button), and edit the time filter so there’s no lower bound. Thereby all historical readings will be included in your total, rather than only the ones that are in the window you’re plotting.
I’m not being very specific about the last part but let me know if you need more pointers.
I’d be cautious about labeling this a bug. I think you need to make sure you have a working Influx query first. The query inspector is your friend in that regard. Have in mind that what you’re doing is certainly not a “standard” use case, so it may well not work out of the box (as you’re finding).
It’s a bit hard to decipher what’s going on from the last two screenshots you posted, but am I right in thinking that:
the query you attempted returns no data if a short recent time period is selected?
the same query returns incorrect data for a longer (last 90 days) time period?
On the latter point, you said “Graph A does not work”. Can you be more specific?
I tried the query Inspector. I disabled all other queries except the one with the non_negative_difference. I returns “data:null”. Without the non_negative_difference function it return normal data.
* the query you attempted returns no data if a short recent time period is selected?
* the same query returns incorrect data for a longer (last 90 days) time period?
Query A does not deliver any data regardless of the selected time period.
Query C works as expected and shows the selected time period but includes data before the selection. But since it does not have the non_negative_difference function, the values it sums up are enormous because it sums up current states instead of differences.
Got it, thanks for clarifying. I was confused in the second screenshot since the alias for both queries was “total”, and when I saw the “total” line I thought that might be from query A.
It might require a subquery to work.
I’ll try to poke around later and let you know. In the meantime, can you confirm what the value of $interval is (should be in the query inspector)?