# Templeting Average temp

I’m having issues getting the average temp. I have 3 thermostats in my house and was using this temple to test to make sure it would give to correct number
{{ state_attr(‘climate.basement_heat’, ‘current_temperature’)

• state_attr(‘climate.basement_heat’, ‘current_temperature’)
• state_attr(‘climate.basement_heat’, ‘current_temperature’) /3 }}
Im getting back 154 as a number if my math is right and if and if all of these are at 66 then 66+66+66/3 = 66 . I dont know how it got 154 for a number?

It’s hard to know why your calculations are off without you posting the entire code where you are trying to calculate it.

This is the temples code. It changed it when I submitted. The dots are supposed to be +

Because the formula you created is doing this:

``````{{ 66 + 66 + 66/3 }}
``````

It’s not dividing the sum by 3, it’s only dividing the last number by 3.

Try this:

``````{{ ( state_attr('climate.basement_heat', 'current_temperature') +
state_attr('climate.basement_heat', 'current_temperature') +
state_attr('climate.basement_heat', 'current_temperature') ) / 3 }}
``````

Obviously your final template should include the names of each one of three thermostats (and not the same thermostat three times).

Have you considered the Min/Max integration?

@rysm83 The Average Sensor works pretty well for me. There are some features of the Min/Max sensor which I find undesireable, as also mentioned in the Average Sensor readme. Although I haven’t looked into the Min/Max Sensor in a while so it might have changed.

I use the Min/Max sensor for my temperature averages and it works great. I know some folks don’t like Min/Max but for this purpose it suited my needs perfectly.

1 Like