WTH isn't there a "except..." for turn off/on ?

I have a few automations that turn on / off all lights except a few specific ones.
It would be great to be able to just add that list to the turn on/off service as a parameter instead of using a template.

Isn’t that what scenes are for?

Can you provide a more specific example?

If you’re asking for a way to run a scene, but exclude some devices, check out this WTH: WTH - Why can't we apply a scene to an area?

If you’re asking to call light.turn_on on an area minus a device, that doesn’t exist yet. While it is a good WTH, I would recommend against using this feature(if it existed) because of the potential headache it could cause.

For example, imagine you target the lights in your living room minus the side table lamps. What happens when you add a new lamp to the room? It won’t be excluded and you’ll have to update every automation with the exclusion. As @sandman98321 mentioned, a scene is more suitable because you update new devices in one spot.

1 Like

This ^ (side note I love @potelux they’ve been a ride or die)

I feel like this actually also ties to a separate post I made WTH - Why isn't there a NOT operator for conditional cards?

I think having more NOT operators/except in home assistant would be cool in general. Sometimes it’s way easier to list everything you don’t want then what you do.

You could easily turn all lights except a subset on/off by leveraging labels. E.g. give all lights you won‘t like to turn off by a specific action (button press, automation….) a label „dont-turn-off“.

Then you can use a template like this:

{{
states.light
| map(attribute=“entity_id”)
| reject(“in”, label_entities(“dont-turn-off”))
| list
}}

Use this template directly in the service call or wrap it in a helper sensor if you like.

This can also be extended to filter areas, floors, other domains etc. These are all accessable in templates.

1 Like