Hey everyone! I’ve been diving into Home Assistant lately and I’m absolutely loving the flexibility it offers. However, there’s one thing I’ve been struggling with—creating dynamic groups for my lights. I want these groups to automatically include or exclude lights based on certain conditions, like whether they’re inside or outside my home.
I came across a post where someone mentioned using templates to dynamically populate group entities. That sounded perfect for my use case! I decided to give it a try, but I ran into some issues. The error message I received was about the entity IDs not matching a specific pattern, which was a bit confusing.
Here’s what I tried in my groups.yaml file:
yaml
home_lights:
name: Home Lights
entities: >
{{ states.light | map(attribute=‘entity_id’) | reject(‘search’, ‘.outside.’) | join(‘,’) }}
The idea was to exclude any lights with ‘outside’ in their entity ID. While the logic makes sense, the error I encountered suggests there’s something wrong with how the entities are being processed. I’m wondering if there’s a different approach or if I’m missing something in the syntax.
Has anyone successfully implemented dynamic groups in Home Assistant? I’d love to hear about your setups and any tips you might have. Also, if you’ve encountered similar errors, how did you resolve them? I’m really excited to get this working because it would save me so much time from manually updating groups every time I add a new device.
Looking forward to your insights! ![]()