How to get a list of groups?

Trying to get a list of all the groups configured in my system. In the past i was able to use the group. domain, but that seems to be gone. The closest i have been able to do is to get a list of all entities that contain an entity_id, but that also includes templates with the below code:

{% set entities = states | rejectattr('attributes.entity_id','undefined') |  list %}
{% for entity in entities -%}
- {{ entity.name }} 
{% endfor %}

When looking at just the entity objects, they show like this:

- <template TemplateState(<state scene.dining_mode=2024-04-26T17:51:30.929124+00:00; entity_id=['light.living_room_lights', 'light.dining_room_lights'], id=1658760920636, icon=mdi:silverware, friendly_name=dinner time @ 2024-11-17T08:53:26.065490-05:00>)> 
- <template TemplateState(<state scene.good_night=2024-06-29T12:34:24.225200+00:00; entity_id=['light.group_all_lights'], id=1667951470832, icon=mdi:sleep, friendly_name=Good night @ 2024-11-17T08:53:26.066031-05:00>)> 
- <template TemplateState(<state scene.test_scene=2024-06-19T22:18:17.330598+00:00; entity_id=['light.kitchen_lights', 'light.kitchen_sink_light'], id=1714146687001, friendly_name=test scene @ 2024-11-17T08:53:26.066171-05:00>)> 
- <template TemplateState(<state scene.test_scene_two=2024-06-19T22:18:21.894552+00:00; entity_id=['light.kitchen_lights', 'light.kitchen_sink_light'], id=1714146735875, friendly_name=test scene two @ 2024-11-17T08:53:26.066394-05:00>)> 
- <template TemplateState(<state media_player.echo_all_upstairs=standby; entity_id=['media_player.kitchen_echo_show', 'media_player.living_room_echo', 'media_player.office_echo_dot'], friendly_name=alexa_all_upstairs, supported_features=55229 @ 2024-11-17T08:54:53.421288-05:00>)> 
- <template TemplateState(<state light.group_outside_lights=off; min_color_temp_kelvin=2000, max_color_temp_kelvin=6666, min_mireds=150, max_mireds=500, effect_list=['blink', 'breathe', 'candle', 'channel_change', 'colorloop', 'finish_effect', 'fireplace', 'okay', 'stop_effect', 'stop_hue_effect'], supported_color_modes=['color_temp', 'xy'], effect=None, color_mode=None, brightness=None, color_temp_kelvin=None, color_temp=None, hs_color=None, rgb_color=None, xy_color=None, entity_id=['light.top_deck_lights', 'light.middle_deck_lights', 'light.carport_lights', 'light.hue_discover_front_yard', 'light.carport_string_lights'], icon=mdi:lightbulb-group, friendly_name=Outside Lights, supported_features=44 @ 2024-11-17T08:53:43.166118-05:00>)> 
- <template TemplateState(<state light.group_all_lights=on; min_color_temp_kelvin=2000, max_color_temp_kelvin=9009, min_mireds=111, max_mireds=500, effect_list=['', 'ARRAKIS', 'Action', 'Action-A', 'Action-B', 'Action-C', 'Action-D', 'Adventure Game', 'Adventure Game-A', 'Adventure Game-B', 'Afternoon', 'Asleep', 'Atlantis', 'Aurora', 'Aurora-A', 'Aurora-B', 'Awaken', 'Ballet', 'Ballet-A', 'Ballet-B', 'Birthday', 'Bloom', 'Breaking', 'Breaking-A', 'Breaking-B', 'Breathe', 'Business', 'Candlelight', 'Cards Game', 'Care', 'Care-A', 'Care-B', 'Carnival', 'Cha-Cha', 'Cha-Cha-A', 'Cha-Cha-B', 'Cheerful', 'Christmas', 'Christmas Gift', 'Christmas Tree', 'Christmas-A', 'Christmas-B', 'Colorful', 'Comedies', 'Cornfield', 'Cosplay', 'Crazy', 'Crossing', 'Dance Party', 'Dance Party-A', 'Dance Party-B', 'Dancing', 'Dancing-A', 'Dancing-B', 'Dancing-C', 'Dating', 'Daze', 'Deep sea', 'Desert', 'Disco', 'Disco-A', 'Disco-B', 'Documentaries', 'Downpour', 'Dramas', 'Dreamland', 'Dreamland-A', 'Dreamland-B', 'Dreamland-C', 'Dreamland-D', 'Dreamland-E', 'Dreamland-F', 'Dreamland-G', 'Dreamlike', 'Dreamlike-A', 'Dreamlike-B', 'Drumbeat', 'Easter', 'Electro Dance', 'Electro Dance-A', 'Electro Dance-B', 'Electro Dance-C', 'Electro Dance-D', 'Electro Dance-E', 'Energetic', 'Energetic-A', 'Energetic-B', 'Energetic-C', 'Energetic-D', 'Enthusiastic', 'Excited', 'Excited-A', 'Excited-B', 'Excited-C', 'Fall', 'Fascination', "Father's Day", 'Fight', 'Fighting Game', 'Fighting Game-A', 'Fighting Game-B', 'Fire', 'Fire-A', 'Fire-B', 'Fire-C', 'Fireworks', 'Fireworks-A', 'Fireworks-B', 'Flash', 'Flow', 'Flow-A', 'Flow-B', 'Flower Field', 'Flower Field-A', 'Flower Field-B', 'Forest', 'Fright', 'Game', 'Game-A', 'Game-B', 'Game-C', 'Game-D', 'Ghost', 'Ghost-A', 'Ghost-B', 'Glacier', 'Glitter', 'Gobi Desert', 'Halloween', 'Halloween-A', 'Halloween-B', 'Happy', 'Happy-A', 'Happy-B', 'Heartbeat', 'Heartbeat-A', 'Heartbeat-B', 'High', 'Jazz', 'Jazz-A', 'Jazz-B', 'Karst Cave', 'Karst Cave-A', 'Karst Cave-B', 'Karst Cave-C', 'Latin Dance', 'Leisure', 'Leisure-A', 'Leisure-B', 'Lightning', 'Lightning-A', 'Lightning-B', 'Lightning-C', 'Literary', 'Longing', 'MFFL', 'Mavericks', 'Meditation', 'Meditation-A', 'Meditation-B', 'Meditation-C', 'Meteor', 'Meteor shower', 'Moonlight', 'Moonlight-A', 'Moonlight-B', 'Morning', "Mother's Day", 'Movie', 'Music: Beat', 'Music: Energic', 'Music: RainbowCircle', 'Music: Rhythm', 'Music: Rolling', 'Music: Shiny', 'Music: Spectrum', 'Music: Strike', 'Music: Torch', 'Music: Vibrate', 'Music: Vivid', 'Mysterious', 'Mysterious-A', 'Mysterious-B', 'New Years', 'Night', 'Night-A', 'Night-B', 'Party', 'Party-A', 'Party-B', 'Party-C', 'Pole dance', 'Pole dance-A', 'Pole dance-B', 'Poppin', 'Poppin-A', 'Poppin-B', 'Poppin-C', 'Poppin-D', 'Poppin-E', 'Poppin-F', 'Poppin-G', 'Poppin-H', 'Poppin-I', 'Profound', 'Puzzle Game', 'Puzzle Game-A', 'Puzzle Game-B', 'Puzzle Game-C', 'Puzzle Game-D', 'Puzzle Game-E', 'Quiet', 'Quiet-A', 'Quiet-B', 'Racing Game', 'Racing Game-A', 'Racing Game-B', 'Rainbow', 'Rainbow-A', 'Rainbow-B', 'Reading', 'Release', 'Release-A', 'Release-B', 'Ripple', 'Romance', 'Romance-A', 'Romance-B', 'Romantic', 'Rush', 'Rustling leaves', 'SPICE', 'Science Fiction', 'Science Fiction-A', 'Science Fiction-B', 'Seasonal', 'Shooting Game', 'Shooting Game-A', 'Shooting Game-B', 'Shooting Game-C', 'Siren', 'Siren-A', 'Siren-B', 'Sled', 'Sleep', 'Sleep-A', 'Sleep-B', 'Sleep-C', 'Snow flake', 'Snow flake-A', 'Snow flake-B', 'Soothing', 'Soothing-A', 'Soothing-B', 'Sports', 'Spring', 'Stacking', 'Star', 'Starry Sky', 'Stream', 'Street Dance', 'Street Dance-A', 'Street Dance-B', 'Study', 'Summer', 'Sunny', 'Sunny-A', 'Sunny-B', 'Sunrise', 'Sunset', 'Suspense', 'Sweet', 'Swing', 'Tango', 'Tension', 'Tension-A', 'Tension-B', 'Thanksgiving', 'Thrillers', 'Tunnel', 'Twinkle', 'Twinkle-A', 'Undersea King', 'Universe', 'Universe-A', 'Universe-B', "Valentine's Day", 'Volcano', 'Volcano-A', 'Volcano-B', 'Waltz', 'Waltz-A', 'Waltz-B', 'War Films', 'War Films-A', 'War Films-B', 'Warm', 'Warm-A', 'Warm-B', 'Watermelon', 'Wave', 'Wave-A', 'Wave-B', 'White Light', 'Winter', 'Work', 'blink', 'breathe', 'candle', 'channel_change', 'colorloop', 'finish_effect', 'fireplace', 'okay', 'stop_effect', 'stop_hue_effect'], supported_color_modes=['color_temp', 'rgb', 'xy'], effect=None, color_mode=rgb, brightness=253, color_temp_kelvin=None, color_temp=None, hs_color=(267.5, 76.19), rgb_color=(111, 45, 189), xy_color=(0.245, 0.111), entity_id=['light.group_inside_lights', 'light.group_outdoor_lights', 'light.group_storage_room_lights'], icon=mdi:lightbulb-group, friendly_name=All Lights, supported_features=44 @ 2024-11-17T15:38:29.612237-05:00>)> 
- <template TemplateState(<state light.group_upstairs_lights=on; min_color_temp_kelvin=2000, max_color_temp_kelvin=9009, min_mireds=111, max_mireds=500, effect_list=['', 'ARRAKIS', 'Action', 'Action-A', 'Action-B', 'Action-C', 'Action-D', 'Adventure Game', 'Adventure Game-A', 'Adventure Game-B', 'Afternoon', 'Asleep', 'Atlantis', 'Aurora', 'Aurora-A', 'Aurora-B', 'Awaken', 'Ballet', 'Ballet-A', 'Ballet-B', 'Birthday', 'Bloom', 'Breaking', 'Breaking-A', 'Breaking-B', 'Breathe', 'Business', 'Candlelight', 'Cards Game', 'Care', 'Care-A', 'Care-B', 'Carnival', 'Cha-Cha', 'Cha-Cha-A', 'Cha-Cha-B', 'Cheerful', 'Christmas', 'Christmas Gift', 'Christmas Tree', 'Christmas-A', 'Christmas-B', 'Colorful', 'Comedies', 'Cornfield', 'Cosplay', 'Crazy', 'Crossing', 'Dance Party', 'Dance Party-A', 'Dance Party-B', 'Dancing', 'Dancing-A', 'Dancing-B', 'Dancing-C', 'Dating', 'Daze', 'Deep sea', 'Desert', 'Disco', 'Disco-A', 'Disco-B', 'Documentaries', 'Downpour', 'Dramas', 'Dreamland', 'Dreamland-A', 'Dreamland-B', 'Dreamland-C', 'Dreamland-D', 'Dreamland-E', 'Dreamland-F', 'Dreamland-G', 'Dreamlike', 'Dreamlike-A', 'Dreamlike-B', 'Drumbeat', 'Easter', 'Electro Dance', 'Electro Dance-A', 'Electro Dance-B', 'Electro Dance-C', 'Electro Dance-D', 'Electro Dance-E', 'Energetic', 'Energetic-A', 'Energetic-B', 'Energetic-C', 'Energetic-D', 'Enthusiastic', 'Excited', 'Excited-A', 'Excited-B', 'Excited-C', 'Fall', 'Fascination', "Father's Day", 'Fight', 'Fighting Game', 'Fighting Game-A', 'Fighting Game-B', 'Fire', 'Fire-A', 'Fire-B', 'Fire-C', 'Fireworks', 'Fireworks-A', 'Fireworks-B', 'Flash', 'Flow', 'Flow-A', 'Flow-B', 'Flower Field', 'Flower Field-A', 'Flower Field-B', 'Forest', 'Fright', 'Game', 'Game-A', 'Game-B', 'Game-C', 'Game-D', 'Ghost', 'Ghost-A', 'Ghost-B', 'Glacier', 'Glitter', 'Gobi Desert', 'Halloween', 'Halloween-A', 'Halloween-B', 'Happy', 'Happy-A', 'Happy-B', 'Heartbeat', 'Heartbeat-A', 'Heartbeat-B', 'High', 'Jazz', 'Jazz-A', 'Jazz-B', 'Karst Cave', 'Karst Cave-A', 'Karst Cave-B', 'Karst Cave-C', 'Latin Dance', 'Leisure', 'Leisure-A', 'Leisure-B', 'Lightning', 'Lightning-A', 'Lightning-B', 'Lightning-C', 'Literary', 'Longing', 'MFFL', 'Mavericks', 'Meditation', 'Meditation-A', 'Meditation-B', 'Meditation-C', 'Meteor', 'Meteor shower', 'Moonlight', 'Moonlight-A', 'Moonlight-B', 'Morning', "Mother's Day", 'Movie', 'Music: Beat', 'Music: Energic', 'Music: RainbowCircle', 'Music: Rhythm', 'Music: Rolling', 'Music: Shiny', 'Music: Spectrum', 'Music: Strike', 'Music: Torch', 'Music: Vibrate', 'Music: Vivid', 'Mysterious', 'Mysterious-A', 'Mysterious-B', 'New Years', 'Night', 'Night-A', 'Night-B', 'Party', 'Party-A', 'Party-B', 'Party-C', 'Pole dance', 'Pole dance-A', 'Pole dance-B', 'Poppin', 'Poppin-A', 'Poppin-B', 'Poppin-C', 'Poppin-D', 'Poppin-E', 'Poppin-F', 'Poppin-G', 'Poppin-H', 'Poppin-I', 'Profound', 'Puzzle Game', 'Puzzle Game-A', 'Puzzle Game-B', 'Puzzle Game-C', 'Puzzle Game-D', 'Puzzle Game-E', 'Quiet', 'Quiet-A', 'Quiet-B', 'Racing Game', 'Racing Game-A', 'Racing Game-B', 'Rainbow', 'Rainbow-A', 'Rainbow-B', 'Reading', 'Release', 'Release-A', 'Release-B', 'Ripple', 'Romance', 'Romance-A', 'Romance-B', 'Romantic', 'Rush', 'Rustling leaves', 'SPICE', 'Science Fiction', 'Science Fiction-A', 'Science Fiction-B', 'Seasonal', 'Shooting Game', 'Shooting Game-A', 'Shooting Game-B', 'Shooting Game-C', 'Siren', 'Siren-A', 'Siren-B', 'Sled', 'Sleep', 'Sleep-A', 'Sleep-B', 'Sleep-C', 'Snow flake', 'Snow flake-A', 'Snow flake-B', 'Soothing', 'Soothing-A', 'Soothing-B', 'Sports', 'Spring', 'Stacking', 'Star', 'Starry Sky', 'Stream', 'Street Dance', 'Street Dance-A', 'Street Dance-B', 'Study', 'Summer', 'Sunny', 'Sunny-A', 'Sunny-B', 'Sunrise', 'Sunset', 'Suspense', 'Sweet', 'Swing', 'Tango', 'Tension', 'Tension-A', 'Tension-B', 'Thanksgiving', 'Thrillers', 'Tunnel', 'Twinkle', 'Twinkle-A', 'Undersea King', 'Universe', 'Universe-A', 'Universe-B', "Valentine's Day", 'Volcano', 'Volcano-A', 'Volcano-B', 'Waltz', 'Waltz-A', 'Waltz-B', 'War Films', 'War Films-A', 'War Films-B', 'Warm', 'Warm-A', 'Warm-B', 'Watermelon', 'Wave', 'Wave-A', 'Wave-B', 'White Light', 'Winter', 'Work'], supported_color_modes=['color_temp', 'rgb'], effect=None, color_mode=rgb, brightness=253, color_temp_kelvin=None, color_temp=None, hs_color=(267.5, 76.19), rgb_color=(111, 45, 189), xy_color=(0.245, 0.111), entity_id=['light.ceiling_color_lights', 'light.coat_closet_light', 'light.big_tv_lights', 'light.dining_room_lights', 'light.upstairs_bathroom_vanity_light', 'light.upstairs_bathroom_light', 'light.living_room_triple_lamp', 'light.office_light', 'light.loft_lamp', 'light.living_room_lights', 'light.kitchen_sink_light', 'light.kitchen_lights', 'light.octopus_lamp', 'light.office_lamps', 'light.stairway_light'], icon=mdi:lightbulb-group, friendly_name=Upstairs Lights, supported_features=44 @ 2024-11-17T15:38:29.601105-05:00>)> 
- <template TemplateState(<state light.group_downstairs_lights=off; supported_color_modes=[<ColorMode.BRIGHTNESS: 'brightness'>], color_mode=None, brightness=None, entity_id=['light.guest_bedroom_fan_light', 'light.hallway_lights', 'light.master_bedroom_fan_light', 'light.salt_lamp', 'light.twin_bedroom_fan_light', 'light.guest_bathroom_lights', 'light.master_bathroom_lights', 'light.closet_lights', 'light.group_hallway_lights'], icon=mdi:lightbulb-group, friendly_name=Downstairs Lights, supported_features=32 @ 2024-11-17T13:49:41.950983-05:00>)> 
- <template TemplateState(<state light.group_outdoor_lights=off; min_color_temp_kelvin=2000, max_color_temp_kelvin=6666, min_mireds=150, max_mireds=500, effect_list=['blink', 'breathe', 'candle', 'channel_change', 'colorloop', 'finish_effect', 'fireplace', 'okay', 'stop_effect', 'stop_hue_effect'], supported_color_modes=['color_temp', 'xy'], effect=None, color_mode=None, brightness=None, color_temp_kelvin=None, color_temp=None, hs_color=None, rgb_color=None, xy_color=None, entity_id=['light.group_outside_lights', 'light.driveway_lights'], icon=mdi:lightbulb-group, friendly_name=Outdoor Lights, supported_features=44 @ 2024-11-17T17:07:54.908340-05:00>)> 
- <template TemplateState(<state light.closet_lights=off; supported_color_modes=[<ColorMode.BRIGHTNESS: 'brightness'>], color_mode=None, brightness=None, entity_id=['light.closet_fan_light', 'light.closet_string_lights'], icon=mdi:lightbulb-group, friendly_name=Closet Lights, supported_features=32 @ 2024-11-17T08:56:19.857728-05:00>)>  

I am looking to figure a way to avoid the first 4 entities that are scenes, but keep the others that are actual groups created in the UI. Anyone know how i can get a list of just entities that are groups?

I take it you don’t want to use Settings | Devices & Services | Helpers?

The group domain still exists, but it doesn’t encompass Helper groups, this is the same behavior that existed previously with groups manually configured under other domain-based platforms.

{{ states.group | map(attribute='name') | list }}

To get all group entities and Helper groups and reject scenes use:

{{ states | rejectattr('attributes.entity_id','undefined') 
| rejectattr('domain','eq', 'scene')
| map(attribute='name') | list }}
1 Like

correct, i am trying to do some fancy front end magic, and need it as a template.