-
-
Notifications
You must be signed in to change notification settings - Fork 419
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Requirements
- I checked the troubleshooting section in the README to verify that I have the latest Mushroom version.
- I did a search to see if there is a similar issue or if a pull request is open.
- I have read the state of card mod support (in pin issues) and understand card mod support is not provided in this repository.
Current Behavior
I created a badge to indicate open windows or doors. In the developer tools, all the code for icon, state, and color works perfectly, but it doesn't work in the badge itself. The badge simply remains empty. I've modified it so that I can assign the individual windows/doors, and that works. But it would be much more convenient and simpler to create the badge directly, especially since it automatically adjusts and expands.
Expected Behavior
No response
Steps To Reproduce
Badge with the yaml code. (Context)
Context
type: custom:mushroom-template-badge
color: |-
{% set open_entities = states.binary_sensor
| selectattr('attributes.device_class', 'in', ['door', 'window'])
| selectattr('state', 'eq', 'on')
| list %}
{% if open_entities | length == 0 %}
{{ 'green' }}
{% else %}
{{ 'red' }}
{% endif %}
icon: |-
{% set open_doors = states.binary_sensor
| selectattr('attributes.device_class', 'eq', 'door')
| selectattr('state', 'eq', 'on')
| list %}
{% set open_windows = states.binary_sensor
| selectattr('attributes.device_class', 'eq', 'window')
| selectattr('state', 'eq', 'on')
| list %}
{% set num_open_doors = open_doors | length %}
{% set num_open_windows = open_windows | length %}
{% if num_open_doors == 0 and num_open_windows == 0 %}
mdi:alarm-light
{% elif num_open_doors > 0 and num_open_windows == 0 %}
mdi:door-open
{% elif num_open_windows > 0 and num_open_doors == 0 %}
mdi:window-open-variant
{% else %}
mdi:home-alert
{% endif %}
content: |-
{% set open_names = states.binary_sensor
| selectattr('attributes.device_class', 'in', ['door', 'window'])
| selectattr('state', 'eq', 'on')
| map(attribute='friendly_name')
| list %}
{% if open_names | length > 0 %}
{{ open_names | join(', ') }}
{% else %}
{{ 'Keine' }}
{% endif %}
label: test
Environment
- Browser: Edge/Chrome/Safari
- HA Version: 2026.2.2
- Mushroom: 5.0.11Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working