State of blind entities in icon

I have blinds in an entities card. As per below screen grab.

I can see an option to open and close the blinds - this works fine. The color of the blinds icon changes to purple when opened and blue when closed. However the blinds icon doesn’t change to an ‘opened’ blind icon when opened and always stays as a closed icon. How can I fix this so that the icon changes to an ‘opened’ blind icon?

Note I have curtains which show an opened (and purple) curtain icon when the curtains are opened, a closed (and blue) curtains icon when the curtains closed. Not sure the problem with the blinds icon!

image

You make a template cover.

Check the available device classes for cover: Cover - Home Assistant

i tried this using ChatGPT followed by a “Quick reload” of Home Assistant but still no success:

homeassistant:
  customize:
    cover.alex_s_blinds_3:
      templates:
        icon: >
          {% if is_state('alex_s_blinds_3', 'open') %}
            mdi:blinds-open
          {% elif is_state('alex_s_blinds_3', 'closed') %}
            mdi:blinds
          {% else %}
            mdi:blinds
          {% endif %}

This code is wrong. Using ChatGPT is not a good idea.
The code is partly from Custom UI - but it contains jinja, and Custom UI uses JS.

2 Likes

Thanks - how do I fix this then?

If you need to set an icon dependently on some conditions - use Custom UI, there are examples there.