I had previously created button cards for each of my docker containers to see what was up, and give me the ability to stop/start them from a dashboard.
Problem is, I’m always tinkering. As time goes on, I shift one container to another server, or shut it down, or add a new container, etc. I wanted a way to programmatically create these buttons.
I’d used auto entities before for bar graphs / battery levels, but never for buttons like this. Took me a while to figure out that since mushroom doesn’t handle a list of entities, I had to instead use a grid and then pass the mushroom template in through the “options” of the auto entity filter. So thought I’d share the love lace and the result! Its really clean, and auto updates now!
type: custom:auto-entities
filter:
include:
- entity_id: switch*docker*
options:
type: custom:mushroom-template-card
primary: |
{{state_attr(entity,'friendly_name')}}
secondary: ''
icon: |-
{% if states(entity) == 'on' %}
mdi:checkbox-marked-circle-outline
{% else %}
mdi:checkbox-blank-circle-outline
{% endif %}
icon_color: |-
{% if states(entity) == 'on' %}
green
{% else %}
red
{% endif %}
tap_action:
action: toggle
layout: vertical
sort:
method: friendly_name
card:
square: false
type: grid
columns: 3
card_param: cards
Example: