What I would like to do: determine the difference in water level (max-min) during the periods when the pump is off (which I can then use to calculate water consumption during the periods when the pump is off).
How would you go about this? I’m happy to re-start the setup from scratch if there is a better way to store the data in order to perform queries. Currently I have:
Bucket: ‘water’
Measurement: ‘raw’
Field: ‘water level’
Field: ‘pump onoff’
I have been playing with queries in the Flux language and am somewhat able to assign pump status to specific timestamps in the water level table (though this isn’t always efficient), but I get most stuck working out how to ‘window’ the data so that I can calculate the min and max values - the pump does not switch on at a set time: it is purely dependent on the level of the water tank, so the off periods are not consistent in start time or duration.
This yields a table of water tank levels when the pump is off. What I would like to do next is split (window?) that table where the gap between consecutive timestamps is greater than 1 minute - this would leave me with separate tables for each pump-off period.
But I’m not sure how to accomplish that, as all the examples I see are related to windowing with respect to a fixed time period, not a gap in the timestamps…
Hello @dunbird,
Unfortunately there isn’t a good solution for this with Flux. I recommend using a client library and executing that logic in the language of your choice. Maybe utilizing smoothing and derivates = 0 for an approximation.