Skip to content

Instantly share code, notes, and snippets.

@anderser
Created September 18, 2022 17:23
Show Gist options
  • Save anderser/31361d7b363cc90d37c96d2d5168e366 to your computer and use it in GitHub Desktop.
Save anderser/31361d7b363cc90d37c96d2d5168e366 to your computer and use it in GitHub Desktop.
Count lights on Home Assistant mushroom card
type: custom:mushroom-template-card
primary: >-
{% if (states.light | selectattr('state', 'eq', 'on') | list | count |float) >
0 %}
{{ states.light | selectattr('state', 'eq', 'on') | list | count }} lys på
{% else %}
Ingen lys på
{%endif%}
secondary: ''
icon: mdi:lightbulb
layout: vertical
icon_color: >-
{% if (states.light | selectattr('state', 'eq', 'on') | list | count |float) >
0 %}
yellow
{% else %}
grey
{%endif%}
badge_icon: ''
fill_container: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment