Dashboard Entities: Conditional Logic to show text based on value

Hi there - first time, long time.

I am trying to create an Entities Card on my dashboard that shows the connected status of my access points. The value of the entity I want to use is an attribute (“internet_online”) and has a boolean value (true/false).

What I wanted to do is the following:
If “internet_online” = true, show “Connected”. If “internet_online” = false, show “Disconnected”.

If possible, I’d love the icon to change colors based on status (green = connected, red = disconnected) but I won’t push my luck :slight_smile:

I’ve tried finding different posts that discuss this, but it’s just not clicking for me at all.

Here’s my code, which is successfully showing the boolean value, not the labels I want:

type: entities
entities:
  - type: attribute
    entity: device_tracker.kitchen_deco
    attribute: internet_online
    icon: mdi:wifi
    name: Kitchen Deco Connected
  - type: attribute
    entity: device_tracker.basement_deco
    attribute: internet_online
    icon: mdi:wifi
    name: Basement Deco Connected
  - type: attribute
    entity: device_tracker.second_floor_deco
    attribute: internet_online
    icon: mdi:wifi
    name: Second Floor Deco Connected
title: Network Status
state_color: true

image

Thanks in advance

Conditional card?

I looked at that but wasn’t sure - it says to show another card based on states of entities.

I see this post which is for showing the ‘closed shade’ when window is closed, then the ‘weather’ when it’s open. That’s very cool, but don’t think it matches my use case.

I’m looking for conditional logic to show text within a basic entities card. I feel like there’s some yaml syntax I’m just not familiar with that might work. I’ve horsed around with a couple options but couldn’t get anywhere.

Thank you though!

As a variant - custom:template-entity-row.

Would you mind elaborating on that?

Use a custom:template-entity-row card inside your Entities card to achieve your described intention.

Got it - that requires a plugin i believe, correct? Is this what you use?

Yes.
Also, find a dedicated huge thread for this plugin in “Share your projects” for discussing issues.

Installed that file, but getting some errors - deleted and reinstalled a couple times to make sure I was doing it right. Thought I did - but still getting the “doesn’t exist” error.

Any other ideas out there?

title: Network
entities:
  - type: custom:template-entity-row
    icon: mdi:wifi
    name: '{{states(''device_tracker.kitchen_deco'')}}'
    state: >-
      {% if is_state('device_tracker.kitchen_deco', "true")%} Connected {% else
      %} Disconnected {% endif %}
    active: '{{ is_state(''device_tracker.kitchen_deco'', '''') }}'

The error is displayed. You do not have this custom card installed.

I got it! Had to delete and re-add the repo again.

Here are some other helpful posts that I used:

  1. How to use is_state() with attributes? - #4 by hass
  2. Templating - Home Assistant
type: entities
entities:
  - type: custom:template-entity-row
    icon: mdi:wifi
    name: 'Kitchen Deco Status:'
    state: >-
      {% if is_state_attr("device_tracker.kitchen_deco", "internet_online",
      true)%} Connected {% else %} Disconnected {% endif %} 
title: Network
state_color: true