How get the minimum/maximum values of a group of sensors?

I see we can get the average values from a bunch of temperature (or other) sensors from here, but is there a way or app to get the min or max values?

I'm looking at using the min/max values relative to a reference to turn on/off a fan.

I'm sure there are other ways but one way is to add your values to a List the use the built in functions:

def list = [9, 4, 2, 10, 5]
assert list.max() == 10
assert list.min() == 2

I'm not aware of any community app that can do this, but that's probably the "easiest" way to get this done. There may be one out there I don't know of. Otherwise, if you prefer to stick to built-in apps, Rule Machine could do this, but it will get a bit awkward to write with the more sensors you add. Here's the general pattern:

Not what you asked but maybe food for thought.

For some data where the device takes multiple readings I found the best way is to use the data is:

  1. take an odd number of readings
  2. sort the array, list etc
  3. use the middle value

This is not the median of average value. Basically it throws out the outlier data. It works well when you readings are either good or way out.

indent preformatted text by 4 spaces
    class Example { 
       static void main(String[] args) { 
        def lst = [13, 12, 15, 14]; 
    def newlst = lst.sort(); 

I get the list but what are the built in functions?

variablemax = datalist.max()
variablemin = datalist.min()

Thanks - I'll look more into that as part of my slowwwww journey with groovy.

In the meantime I did it through node red although for a fairly basic task like this I'd really prefer it to be kept in HE. Times like this I wish RM had more maths functionality!

@rocketwiz Have the same issue, did you find a simple way to solve this? Thanks

If you need to do min/max - @bravenel kindly wrote an app here Averaging - #112 by bravenel