Hey,
I’m using a mushroom template card with this code to show open windows.
{{ states.binary_sensor|selectattr('name','contains','Offen')|selectattr('state','equalto','on')|list|length }}
This works and I want to use this in ha. Therefor I add the following into the configuration.yml
template:
- sensor:
- name: "Anzahl Fenster Gekippt"
state: >
{% set gekippt = states.binary_sensor|selectattr('name','contains','Gekippt')|selectattr('state','equalto','on')|list|length %}
{{ (gekippt) }}
- name: "Anzahl Fenster Offen"
state: >
{% set gekippt = states.binary_sensor|selectattr('name','contains','Gekippt')|selectattr('state','equalto','on')|list|length %}
{% set offen = states.binary_sensor|selectattr('name','contains','Offen')|selectattr('state','equalto','on')|list|length %}
{{ (offen - gekippt) }}
There are no errors, but I cant’t access the two sensor with a entity card.
What I’m doing wrong?