Template sensor not working as expected

I felt like this should work, but I’m not seeing the icons in my sensors in the UI. Any tips

      security_system_state:
        value_template: '{{ states.input_select.security_system.state }}'
        friendly_name: 'Security System'
        icon_template: >
            {% if is_state('states.input_select.security_system.state', 'Disarmed') %}
                mdi:home-lock-open
            {% elif is_state('states.input_select.security_system.state', 'Armed (Home)') %}
                mdi:home-lock
            {% elif is_state('states.input_select.security_system.state', 'Armed (Away)') %}
                mdi:security-lock
            {% else %}
                mdi:help
            {% endif %}

Looks fine to me. Are you sure that you’ve reloaded HASS, and maybe tried to clear the cache of your browser?

Or use the settings to check your config, maybe something pops up there?

The only icon that is appearing is the mdi:help, and even that only shows if I click on the sensor, I was hoping the sensor would show the icon in the circle
2018-05-242018-05-24%20(2)

Have a look at this:

Basically it comes down to this:

No difference. Hmm,

      security_system_state:
        value_template: '{{ states.input_select.security_system.state }}'
        friendly_name: 'Security System'
        icon_template: >
            {%- if is_state("states.input_select.security_system.state", "Disarmed") -%}
                mdi:home-lock-open
            {%- elif is_state("states.input_select.security_system.state", "Armed (Home)") -%}
                mdi:home-lock
            {%- elif is_state("states.input_select.security_system.state", "Armed (Away)") -%}
                mdi:security-lock
            {%- else -%}
                mdi:help
            {%- endif -%}

I also tried double quotes as shown above. No change. Maybe does not work with input select?

Is the state needed after "states.input_select.security_system.state"? I’m not sure but I think I remember not adding that when I was wrestling around with the state of input_selects.

Good call, almost there

      security_system_state:
        value_template: '{{ states.input_select.security_system.state }}'
        friendly_name: 'Security System'
        icon_template: >
            {%- if is_state("input_select.security_system", "Disarmed") -%}
                mdi:home-lock-open
            {%- elif is_state("input_select.security_system", "Armed (Home)") -%}
                mdi:home-lock
            {%- elif is_state("input_select.security_system", "Armed (Away)") -%}
                mdi:security-lock
            {%- else -%}
                mdi:help
            {%- endif -%}

Works but not as I expected, when I click on the item I see the mdi icon now, but still not here.

2018-05-24

Probably something I’m misunderstanding.

Looks like I need to look into

entity_picture_template:

Not sure I want to take the time to grab local images for these. Thanks for the tip about removing state though. :slight_smile: