Change icon and color on Entities card for one entity

Hello,

I have a Google Wifi sensor, and i want to change the icon if state == Online

I tryed this from my dashboard:

type: entities
entities:
  - entity: sensor.google_wifi_status
    secondary_info: none
    name: Status
    icon: |-
      {% if is_state('sensor.google_wifi_status', 'Online') %}
        mdi:wifi
      {% else %}
        mdi:cancel
      {% endif %}
    icon_color: |-
      {% if is_state('sensor.google_wifi_status', 'Online') %}
        green
      {% else %}
        red
      {% endif %}

But, this don’t work, and i try lot of things templating but i don’t know why i can’t use interpreted code inside this key.

Can you help me please ?

OK, i found.

Need to use template-entity-row to do what i want :smiley:
Thanks

type: entities
entities:
  - entity: sensor.google_wifi_status
    type: custom:template-entity-row
    secondary_info: none
    name: Status
    state: |-
      {% if is_state('sensor.google_wifi_status', 'Online') %}
        En ligne
      {% else %}
        Hors ligne
      {% endif %}
    icon: |-
      {% if is_state('sensor.google_wifi_status', 'Online') %}
        mdi:wifi
      {% else %}
        mdi:cancel
      {% endif %}
    color: |-
      {% if is_state('sensor.google_wifi_status', 'Online') %}
        green
      {% else %}
        red
      {% endif %}