Exclude Entities: Turn on/off everything, except X

Hey Guys

Are you still interested in being able to exclude something from a group?

I also need this feature so I started tinkering with the code to make it work. It works roughly on groups so if you turn on/off a group with items excluded, those don’t get actioned. They do however participate in determining the group’s state. You can also use this in scripts for light/switch domains for now. Just add ‘exclude’ where you see ‘entity_id’. You should also be able to exclude a group from a group.

The initial commit is here:
https://github.com/mateuszdrab/home-assistant/commit/d4b7f62dc686759fd69719ff5ac82d8bcb1a582f

Example:

{
  "entity_id": "group.test2",
  "exclude":"light.bed_lamp"
}

and an example in a script

test_lights:
  sequence:
  - service: light.turn_on
    entity_id: group.test2
    exclude: light.bed_lamp

This is probably bound to be buggy as hell since I’m not a Python programmer but a C# guy however it seems that Python is amazingly simple and it’s gone well so far.

Looking forward to some feedback, you should be able to pull the master branch from me as this was merged with latest master from homeassistant today.

Thanks

1 Like

Did this ever get implemented? I would like this also!

Still not working I guess… Would be a good thing to have.

This would be awesome!

piling on here as I would also really like to see something like this. My use case is simple and I believe a very good argument for the need for this feature.

My automations, groupings and sheer number of devices is growing very quickly. Managing automations and scenes that turn on/off groups of devices becomes difficult to manage in terms of updating and maintaining them. Its much easier to split into groups and write automations that trigger scenes or turn on/off groups.

In many cases I need to aggregate groups together in order to avoid turning off or on something that otherwise belongs in the same group as everything else.

chiming in here as well - this would be great to see this implemented. My use case is similar to those above: I want to easily turn off all lights except the master suite. When I add more lights to HA, I don’t want to have to re-do groups to add them back in.

I would like to see this also. I have a few things I use all switches on for - issue is, i’ve added an alarm siren to my home and now when I turn all switches on, my alarm sounds outside. It seems like this feature should be here all ready! It’s been asked for since 2016…

I have tried everything and still need this feature in HASSIO. If I say google, turn everything on, it will turn on thing like sirens, whole house fans (with the windows closed), set off my smoke detectors! It becomes a dangerous command. We need to be able to exclude devices! This seems so easy to do?

+1 This feature would significantly simplify things

This would be a fantastic feature. I have an automation to turn off all the light except on ( at night ), when nobody is home. But now, I need to add all lights to one group to turn off all the lights except that one.

I too would like to see this feature. Being able to turn off all lights except the outdoor lights would be very practical in several scenarios.

You can try turning all off then turning one on.

Yes, this was already mentioned here in post #13: In a scene it’s unpredictable, which command (on or off) is executed first. You could implement it as a script and include a delay, but it makes this workaround even worse in my opinion.

And, last but not least, there are devices that take it badly to be turned off at all, f.e. computers. Or my lawn mower, which immediately starts panicking, if it can’t detect it’s perimeter wire anymore…

Hey @matthewjohn, I feel you! When my google home accidentally turned on every light and socket in my home for the first time, transforming it into a fun fair, I seriously began to doubt, if anyone working for the google home developer team is actually living in a real smart home…

The first thing I did was to add all phrases which came to my mind to a routine that just answers, that it won’t turn everything on or off at once. But even with currently about 20 phrases in these routine some weeks ago a friend of mine still managed to turn everything on by using some regional slang I didn’t think about… :man_facepalming:

1 Like

If anyone is interested in another approach for this problem, you may check out the minimal example I posted here:

1 Like

How many people have to vote on this before we see it?

Honestly, I don’t think it works like that.

My impression is that there’s no threshold beyond which a Feature Request ‘wins the lottery’ and becomes implemented. I feel the odds of that happening largely depend on how much a Feature Request piques a developer’s interest.

Why vote then?

1 Like

So …

In recent 0.85.x changes, entity_id: all is required to target all entities of a particular domain. The following warning appears in the log if entity_id: all is not specified:

"Not passing an entity ID to a service to target all entities is deprecated. Use instead: entity_id: "all."

Therefore, I feel that it is even more useful and appropriate to implement an “EXCLUDE” feature.
The use case is simple:

- service: light.turn_off
  entity_id: all
  exclude: light.porch_light

This would greatly simplify configurations and for users such as myself with many devices, would be of great value. Putting lights (and other devices) into internal and external groups is a poor workaround at best, while this method would be far more scalable and flexible in my opinion and does not appear to be overly complex to implement.

4 Likes

Maybe this also comes close to what you request. It’s a way to create groups excluding members of other groups. You could then use the new group to turn off your lights (minus the few excluded ones). And you can use the groups in triggers, too, if you like.