Title: Dynamic group of entities based on name pattern (e.g. ends with _water_leak
)
Body:
Hi everyone!
I’d love to see support in Home Assistant for creating dynamic groups based on entity ID patterns, like all binary_sensor
entities that end with _water_leak
.
Why this feature is useful
Many sensors (especially from Zigbee2MQTT) follow a consistent naming scheme. In larger setups (20–50+ devices), it’s a hassle to keep manually updating group:
or trigger.entity_id
lists every time a new sensor is added.
For example, I have dozens of leak sensors named like:
binary_sensor.kitchen_water_leak
binary_sensor.bathroom_water_leak
binary_sensor.garage_water_leak
...etc.
If I could automatically group these by pattern (_water_leak
), it would save tons of time and reduce human error.
What I imagine
A simple group like:
group:
water_leak_sensors:
platform: dynamic
domain: binary_sensor
match: '_water_leak$' # regex or endswith-style filter
Or maybe a template-driven group:
group:
auto_leak_sensors:
entities: >
{{ states.binary_sensor
| selectattr('entity_id', 'match', '_water_leak$')
| map(attribute='entity_id')
| list }}
Bonus points if this group can be reloaded dynamically or via automation/script!
Workarounds today
Right now I have to:
- Manually list all matching entities in the
group:
- Or manually paste them into automations every time something changes
- Or write a helper automation to update
input_text
and parse that
…but none of these truly replace a real, dynamic group.
Thanks for considering! I’d love to hear if others also face this need.