Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Home Assistant - Ho...
 
Share:
Notifications
Clear all

[Solved] Home Assistant - How to grey out cards when entity is not available

1 Posts
1 Users
0 Reactions
9 Views
 Hans
(@hans)
Famed Member Admin
Joined: 13 years ago
Posts: 3134
Topic starter  

So I use Home Assistant to manage my 3D printer and when the printer is off, and its entities are "unavailable", I'd like controls to become greyed out.
Vice versa, when the printer is on, and its are available, I'd like them to show as normal cards.

By default either the text "unavailable" will be shown and/or a small badge will be shown with an exclamation mark in it.
Not what I had in mind.

Took me a while to figure this out, but here is where Card Mod comes to the rescue by applying a CSS style when an entity is not available.

First make sure Lovelace Card Mod is installed! (free)

Next for each card apply this card mod:

type: entity
entity: sensor.example_sensor
card_mod:
  style:
    .: |
      ha-card {
        {% if is_state(config.entity, 'unavailable') %}
          filter: grayscale(100%) brightness(0.8);
          opacity: 0.6;
        {% endif %}
      }

If the entity state is "unavailable" the card will turn grey scale, darker, and a tiny bit transparent.

Example entity available:

Example entity not available:

 

Hope this is helpful for others ... 😊 



   
ReplyQuote
Share: