Switch between icons

Hi! I have a sensor in my house that shows whether my door is locked or unlocked. I would like to have one icon in the home assistant interface when the door is locked and another one when its unlocked. So Im wondering if that is possible in some kind of way.

I believe that you can use icon_template: to achieve this.

I haven´t started used it myself yet, but from this post you have this:

icon_template: >
  {% if is_state('input_boolean.template_icon', 'on') %}
    mdi:garage-open
  {% else %}
    mdi:garage
  {% endif %}
2 Likes