I’m trying to set some templates in my HA and my first step was to try the example presented in the HA template guide, basically and average of 2 different temperatures. I’ve configured the templates as follows:
1- I cannot read the average temperature, the sensor template appears as unavailable. Anybody knows the reason why?
2- The template value should change anytime any of the 2 values changes, but according to the configuration, it will only change when the 1st value changes. Why?
My guess is either a typo in your second entity ID, or that sensor is returning unavailable or unknown.
You could set each sensor’s float default value to the other sensor, such that if one goes offline, the average is simply the state of the other one. Like this, giving up on the inside float:
{% set T1 = states('SENSOR1')|float(states('SENSOR2')|float('unavailable')) %}
I can duplicate your results when the first entity_id in the template either doesn’t exist or doesn’t have a numeric value.
Ensure sensor.salon_temperature is spelled correctly.
Ensure it has a numeric value. To guard against non-numeric values use float(0) in your template, where 0 represents the value you want to use when the sensor’s actual value is not a number.
It fixed nothing, just masked the problem. That’s why the end-result is unchanged.
Review the explanation I provided in my previous post. It’s either a spelling error or the sensor’s value is non-numeric (supply float with a default value).
You were right, It was a spelling problem. Was “temperatura” instead of “temperature”. The problem was the TADO integration, that is created with variables of the system with the same language as its settings, in this case spanish.
Pasting the code as text (and formatted correctly) helps other help you. As you saw from other replies, someone replicated your code in their own system, and someone else replied with a suggested edit. With an image only, you’re requiring those people to transcribe from your image which is both tedious, and could introduce new errors that slow down you getting a get response to your question. I’m not trying to scold; I’m just trying to provide helpful context on the reason to use well formatted code text instead of only images.