Hi,
I’m new to Home-Assistant and was wondering If it is possible to create a template that provides a sensor for every climate device that is connected. I read:
Is it possible to use somekind of wildcard like climate.*? So that I would get an additional temperature sensor entity for all my climate devices without having to write a template for every climate device.
I’m sure there’s some yaml technique like anchors that could be used, but I’d just use templates to build templates. You could paste something like the following into the template editor, then copy the ouput and paste it into your config.
#For use in Template Editor ONLY
# DO NOT USE DIRECTLY AS CONFIGURATION
template:
sensors:
{%- set clim = states.climate | map(attribute='entity_id') | list %}
{% for c in clim %}
- name: {{ state_attr(c, 'friendly_name') }} Temp
state: >
{% raw %}{{state_attr('{% endraw %}{{c}}{% raw %}', 'current_temperature')}}{%endraw%}
unit_of_measurement: '°C'
state_class: measurement
availability: >
{% raw %}{{state_attr('{%endraw%}{{c}}{%raw%}', 'current_temperature')| is_number }}{%endraw%}
{% endfor %}