{% set temp = states('sensor.br_temperature_2') | float %}
{% set therm = states('sensor.entryway_thermostat_target') | float %}
{% if temp > 16 and therm > 16 %} 10
{% elif temp < 10 and therm < 10} 16
{% else %} 12
{% endif %}
First thing you may notice is that I used the float filter to ensure all entity states are numeric. Second, when testing the variables, I compared them to numeric constants, like 16, as opposed to strings, like "16". Lastly, I added a final {% else %} to handle the case where neither of the first two tests is satisfied (I chose a random value of 12). This ensures the template always returns something (as opposed to nothing). If you are certain that returning nothing is acceptable for this template, then you can remove that line.
you can still do it the way you had it written but with a few fixes.
As @123 said you need to add the “float” filter to force it to a floating point number (or you could use “int” if you only wanted to match integers).
Next you need to remove the second “and” in your “elif” statement.
And it would be best practice to add the “else” also as 123 said above to catch other conditions tho it isn’t strictly required. However, you will get an error in your log if the template fails to render due to an uncaught condition. So it’s better to have it than not.
And, lastly, it would be best to use the states() method to extract the state of the entity rather than the states.xxx.state method because if those values don’t exist you will also get errors in the log.
so the end result should look like this using your original syntax:
Thank you for the info! Clear and understandable. So the state() gives a error when it not exists? So that’s a better solution. I already find out I made some little typo mistakes and didn’t find out why a automation is not working haha