Hi,
I have this template sensor to show me what doors are opened, and I need a similar one for windows and lights. I don’t have any coding skills so it’s hard for me to make the template from scratch so I tried to replace “door” with “window” but it doesn’t work… I doesn’t even show as a sensor entity.
- name: "What doors are opened"
unique_id: xxxxxxxxxxxx
icon: mdi:door-open
state: >
{%- set ns = namespace(doorsensors=[]) -%}
{%- set ns.doorsensors = states.binary_sensor
| selectattr('attributes.device_class', 'defined')
| selectattr('attributes.device_class', '==', 'door')
| selectattr('state', 'eq', 'on')
| map(attribute='name') | list -%}
{%- if (ns.doorsensors | count > 0) -%}
{{ ns.doorsensors | list | join('\n')}}
{%- else -%}
none
{%- endif %}