diff --git a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml index 1dbd69da..3a2c37b9 100644 --- a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml +++ b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml @@ -194,7 +194,7 @@ card_param: cards filter: include: - - group: switch.docker_monitored_containers + - entity_id: "/^switch\\..*_container(_2)?$/" options: type: custom:button-card template: bearstone_infra_container_row diff --git a/config/dashboards/infrastructure/partials/home_sections.yaml b/config/dashboards/infrastructure/partials/home_sections.yaml index 92cdd705..2c67b332 100644 --- a/config/dashboards/infrastructure/partials/home_sections.yaml +++ b/config/dashboards/infrastructure/partials/home_sections.yaml @@ -449,7 +449,7 @@ card_param: cards filter: include: - - group: switch.docker_monitored_containers + - entity_id: "/^switch\\..*_container(_2)?$/" options: type: custom:button-card template: bearstone_infra_container_row diff --git a/config/dashboards/infrastructure/templates/button_card_templates.yaml b/config/dashboards/infrastructure/templates/button_card_templates.yaml index 365b507f..d7c26ad3 100644 --- a/config/dashboards/infrastructure/templates/button_card_templates.yaml +++ b/config/dashboards/infrastructure/templates/button_card_templates.yaml @@ -614,13 +614,15 @@ bearstone_infra_container_row: } const switchEntity = key ? `switch.${key}_container` : ''; const switchEntityAlt = key ? `switch.${key}_container_2` : ''; - const monitored = states['switch.docker_monitored_containers']?.attributes?.entity_id || []; + const monitored = states['switch.docker_monitored_containers']?.attributes?.entity_id; const restartCandidates = key ? [ `button.${key}_restart_container`, `button.${key}_restart_container_2`, ] : []; const hasRestart = restartCandidates.some((candidate) => states[candidate]); - const isMonitored = monitored.includes(switchEntity) || monitored.includes(switchEntityAlt); + const isMonitored = Array.isArray(monitored) + ? monitored.includes(switchEntity) || monitored.includes(switchEntityAlt) + : (ent.startsWith('switch.') && (ent.endsWith('_container') || ent.endsWith('_container_2'))); return (hasRestart && isMonitored) ? 'block' : 'none'; ]]]