Binary sensor template not displaying in mushroom template card

Hi all,
I have this template setup:

{% set open_windows = states.binary_sensor 
| selectattr('state', 'eq', 'on')
| selectattr('attributes.device_class', 'eq', 'window') 
| list %}
{% if open_windows | length > 0 %}
{% for window in open_windows %}
- {{ window.name }} (open for {{ relative_time(window.last_changed) }})
{% endfor %}
{% else %}
No windows are open
{% endif %}

It works fine in dev tool, but I can’t make it work in mushroom template card no matter what.
Can you see what’s wrong?

Select for device class being defined first:

{% set open_windows = states.binary_sensor 
| selectattr('state', 'eq', 'off')
| selectattr('attributes.device_class', 'defined')
| selectattr('attributes.device_class', 'eq', 'window') | list %}
{% if open_windows | length > 0 %}
{% for window in open_windows %}
- {{ window.name }} (open for {{ relative_time(window.last_changed) }})
{% endfor %}
{% else %}
No windows are open
{% endif %}