How to find the average of multiple Temperature Sensors

If you’re interested, here’s a shorter way to achieve the same result.

{% set a = ['sensor.outside_front_climate_temperature', 'sensor.outside_rear_climate_temperature'] 
  | select('has_value') | map('states')
  | map('float', 0) | average(none) %}
{{ a if a is not none else states('sensor.nws_temperature') }}
  • has_value('sensor.my_sensor') will test if the given entity is not unknown or unavailable. Can be used as a filter or a test.

Reference

Templating - States

3 Likes