Hi,
I’m trying to use a dynamic icon template for a template sensor. The config is the following:
- platform: template
sensors:
multisensor_chambre_batterie:
value_template: '{{ states.zwave.multisensor_chambre.attributes.battery_level }}'
friendly_name: Batterie
unit_of_measurement: '%'
icon_template: >
{% if states.zwave.multisensor_chambre.attributes.battery_level|int < 20 %}
'mdi:battery-alert'
{% else %}
'mdi:battery'
{% endif %}'
In the frontend, there is no icon displaying. If I paste the template in the templates tools (developers tools), it displays ‘mdi:battery’.
What’s wrong?