Min and Max values from influxdb persistence

Any examples how to get min and max value during specific time range? I have underfloor heating and capturing outlet temperatures, all values saved in influxdb. I need to extract from database min and max outlet values each day during 9:00-17:00 time for specific rule.

This can’t be done using the built in persistence actions. You can only ask for the value between now and some point in the past. So you have several options:

  • trigger a rule when the value changes, if it’s between 09:00 and 17:00 check to see if the new value is less than the current min value (stored in an Item or global variable) or greater than the max value (stored in an Item or global variable).

  • call out to a script that performs the query on the IbnfluxDB using the InfluxDB tools and/or API.

Another approach depends on when you need this data. You can use built-in persistence maxSince() etc. from now-24hours to now, in a job that runs at the end of each day. These end of day min/max can themselves be persisted for charting etc.