Exclude device LEDs from area actions

I use areas for automatons and switches. It makes life easy; if I add a new light to a room, just add it to the area and all my existing automatons/controls work. Just one minor annoyance: many devices (ESP32Home especially) expose the little LED as a light, and this gets included. I could create a separate group, but that requires action every time lights get added. Is there a better way to deal with this problem?

Why do you add the light in the configuration of the ESP?

It’s added by the integration. You might still want to control them (e.g. light up when a presence sensor detects you). I just don’t want it included in the list of lights for the room.

Instead of using the area id in your automations, you could use the entity_ids, pulled dynamically for that area, then exclude the ones you don’t want.

I have this exact situation with 2 media players in the same area. One is just for voice/assist, the other is for music, so you could do something like this:

{{ area_entities('lounge') | select('search','lights') | reject('search','led') | list }}

Perfect, this is exactly what I was looking for!

1 Like