Show groups as badges

Hey there,

With a simple script i count all open windows (binary Sensors). The number of open windows is shown in a badge.

When clicking the badge i get a more-info Dialog that shows me only the changes of the amount of Open windows at a Timeline. It would be Great if i could Show instead of the default more-info Dialog a list with all windows and their states. Something like the group-more-info Dialog Looks like.

Is there an Solution for what i want to do? Isnt this a normal use Case?

Would like to hear from you .

Cheers Nic.

Does really no one has an use case for this?

How do you manage this?

When my wife leaves the house, she wants to know how many windows she left open and then - which windows have been left open. Is my wife untypical? :slight_smile:

Is there the possibility to add groups as a badget and then count states inside the group?

To answer your original question, you could probably set the specific windows as ‘attributes’ to the sensor your script is creating. I’d think it would just be a dictionary/hash of the window sensor ids and whether they’re open or not.
I’m not sure if there’s another/prettier way to do that.

Hey,

Thanks for replying.

Could you explain your approach a little bit further? I am quite new to hass and still Learning a lot.

Here is One of my Counting scripts, here for lights. Where could i Add attributes and how to Count and display them in the badge and them how to Show all relevant entities?:
indent preformatted text by 4 spaces

 {% for state in states
       if ( 'light' in state.entity_id 
            and state.domain in ['light','switch']
            and state.state == 'on' ) -%}
     {% if loop.last -%}
       {{ loop.index }}
     {%- endif %}
   {% else %}
     0
   {%- endfor %}

Hey there and Hey @justyns I´ve been on the road the last days, so now I can post the actual script, which is in the configuration.yaml:

sensor:
  - platform: template
    sensors:
 
 
  mean_lux:
    friendly_name: 'Fenster offen'
    value_template: >
                    {% for state in states
                        if ( 'binary_sensor' in state.entity_id 
                             and state.state == 'on' and state.attributes.device_class == 'opening') -%}
                      {% if loop.last -%}
                        {{ loop.index }}
                      {%- endif %}
                    {% else %}
                      0
                    {%- endfor %}

Does anybody have an idea, how to go further on?