MQTT sensors do not have an icon_template attribute.
They do support device classes though.
What is your sensor, there may be a class that fits?
These are UV sensor and rain sensors: rain per hour(mm/hour) and rain for 24hours(mm).
I want to change an icon depending from the sensor state.
icon_template: >-
{% if value | float(0) > 0 %}
mdi:umbrella-outline
{% else %}
mdi:umbrella-closed-outline
{% endif %}
Ok, neither of those have a suitable device class.
Don’t forget to vote for your own request.
1 Like