Calculating the "Averge" temp of a room - Correct Math Config


#1

1) Give a description of the problem
The real temp of a room based on multiple temps

2) What is the expected behaviour?
To come up with a “Virtual” temp

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.

So I can come up with a piston and put the value into a variable and create a simulated device to hold the temp no problem. What I want to know is what you really want is the average? Let’s say I have 5 temp sensors in a room. Do I really want to average them. Let’s say that you have a sensor that the battery dies, and you missed it, and the last temp was out of the norm do you really want to use that temp or throw it out. Or do you really want to create a standard deviation and if the sensor falls outside of that you throw it out and what would that look like in an equation. OR is there a better way to do it. For you math junkies what is the real way to create the temp based on 5 sensors. Throw out the low and high and average?


#2

The math portion of this would be fun (for me), but I would think it would be better to simply be alerted to a dead battery, instead of doing math based on the remaining sensors.

Just my two cents.


#3

I normally use them all when calculating the average, but sometimes display the highest and lowest of the bunch as well. (well, not really all of them. For example, I do not use the temp in the garage when averaging my internal temp)


If you really want to drop the max and min temps, you can use the Expression:
min(val1, val2, val3) and max(val1, val2, val3)
to determine the extremes.


#4

I agee but I just want to make sure we get better averages. Yea I would want to be alerted but if I am not home, on vacation, or playing golf, I may not be able to change the battery before my AC or heating starts running


#5

For the record, I would not rely on battery devices during vacation.
In my opinion, logic during vacation should be based on time or devices with AC power.


#6

I here what you are saying, but I would be interested in the Math Wiz’s on what they would do if you had to rely on battery devices. I mean you have to rely on temp sensors and you want to set them up for the comfort of your home which you are there most of the time. When you go on vacation that to me is an extreme, especially with COVID. You really don’t want to make changes to your system just because you are leaving for half a day or more (Golf is about 4-6 hours depending on your course). Again I could do the min and the max and average (and already have), blah, blah, blah. I want to see what people come up with. There are so many options out there what is everyone’s best


#7

OK fair enough. For an eight hour “vacation”, there is no need to program anything fancy…


(Now that I have mentioned my disclaimers)
Here is how I would do it:

  • Grab all temps, and store into variables
  • Use min() and max() to determine the highest and lowest
  • Calculate the average based on the remaining numbers.

Pro Tip:

If you ever plan to go on a “normal” vacation (3 days or more), then it is definitely worth programming for things to happen differently when you are away.

To me, this is smarter than “dumbing down” the code for 365 days a year…


#8

I don’t know how low you go with your batteries but in my experience, I change them as soos as they hit 30% because sensors tend to work less efficiently with low battery levels. I know some people here they won’t even go down to 30%