Last active
February 17, 2022 10:56
-
-
Save alphasixtyfive/499986276170a52fcb7a767569b7229d to your computer and use it in GitHub Desktop.
Homeassistant - count lights that are on in specific areas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template: | |
- sensor: | |
- name: Lights on | |
icon: mdi:lightbulb | |
state: >- | |
{% set exclude_areas = [None, 'Volvo'] %} | |
{{ states.light | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | map('area_name') | reject('in', exclude_areas) | list | count }} | |
attributes: | |
areas: >- | |
{% set exclude_areas = [None, 'Volvo'] %} | |
{{ states.light | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | map('area_name') | reject('in', exclude_areas) | unique | list }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment