Icon templating not working

You can’t template in lovelace without custom cards.

see this custom card:

type: 'custom:card-templater'
card:
  type: entities
  title: Bathroom
  entities:
  - entity: light.bathroom_light_light
    name: Main Light
    toggle: true
    type: 'custom:slider-entity-row'
  - entity: switch.bathroom_fan_switch
    name: Fan
    icon: |
      {% if is_state('switch.bathroom_fan_switch', 'on') %}
        mdi:fan
      {% else %}
        mdi:fan-off
      {% endif %}
  - entity: sensor.bathroom_sensor_humidity
    name: Humidity
1 Like