Problem with icon

hello community,

I have the following, this is in Packages code::

input_boolean:
  nachtmodus:
    name: Nachtmodus

template:
  - binary_sensor:
      - name: "Nachtmodus Icon"
        state: "{{ is_state('input_boolean.nachtmodus', 'on') }}"
        icon: >
          {% if is_state('input_boolean.nachtmodus', 'on') %}
            mdi:white-balance-sunny
          {% else %}
            mdi:weather-night
          {% endif %}

which works

perfectly.

if I change it to this:

input_boolean:
  nachtmodus:
    name: Nachtmodus

template:
  - binary_sensor:
      - name: "Nachtmodus Icon"
        state: "{{ is_state('input_boolean.nachtmodus', 'on') }}"
        icon: >
          {% if is_state('input_boolean.nachtmodus', 'on') %}
            /local/custom_icons/zon1.svg
          {% else %}
            /local/custom_icons/maan1.svg
          {% endif %}

I get this result. I don’t understand why. I have other things in the www folder and they all work perfectly. Can someone explain this to me? Thanks in advance

Where in the documentation are you seeing that the icon configuration variable accepts a file path? That’s not something I’m familiar with… maybe you are confusing it with the picture config variable or something from a custom dashboard card?

There is, however, a custom integration to help with this kind of thing:

Thank you for the solution. Of course, I hadn’t seen this again. :grimacing: