Turning off all house lights with automation

I noticed recently that my presence based automation for turning off all the lights and switches in my house wasn’t working. A quick search revealed that it may be to do with the depreciation of groups in the last update (.105 I think.)

Can someone confirm if it’s true that"group.all_devices", “group.all_lights”, and “group.all_devices” are no longer valid? If so, is there a function to replace them?

1 Like

Correct, the auto-generated groups are no more. You could use entity_id: all with a light.turn_off service call though.

8 Likes

Other options listed here:

Excellent, this helps. Now for the second part of my problem. I have a presence based automation, that turns everything off after a period of time. Is there a better way to recreate this now as group.all_devices has been depreciated?

Code as it now stands:

- id: '1537562738209'
  alias: Away
  trigger:
  - entity_id: group.all_devices
    from: home
    platform: state
    to: not_home
  condition: []
  action:
  - data:
      entity_id: all
    service: light.turn_off
  - data:
      entity_id: all
    service: switch.turn_off

You could manually re-create that group (and any other group you want) and use it in the trigger.

If you have lights of the same type there might be the option to create a group that includes all lights with the native method of control and expose that group as an individual light to Home Assistant (thus the turning off/on commands will be instantly applied case you have several lights that you might want to change in the same time).

It turns out, I had already done this. I don’t know when, or why, but I’m not complaining. I haven’t confirmed that it’s working yet, but I don’t see why it wouldn’t. Thanks a million :slight_smile:

Only works using yaml? Can’t set entity to ‘all’ in (automation) ui.

I just wrote all in Choose entity and it works. No suggestion dropdown though.

only worked for half of my light enttites. Got some on tasmota and some using local tuya maybe why.
Probably need to add them all to a group

Thank you for this. Makes things a lot easier, luckily I found this for whatever reason “undocumented trick” :+1:

service: light.turn_off
data: {}
target:
  entity_id: all

So I guess all basically is some kind of magic word which should work in other situations like for other services and domains too, right?

1 Like

This snippet using “all” shows correctly in YAML, and it works, but still doesn’t display correctly in the automation UI.

Light: Turn off unknown entity

Capture

Indeed, I accidentally came across this recently too.
Seems to be an “undocumented hack” which is therefore not taken care of in the UI probably.

“Ugly, but working.”

Just beware that in my setup switch all off also turned WiFi off in the Ubiquiti unify controller.

This caused my laptop to lose connection, and i had to fumble for a network cable in the dark, because my Google Home speakers also were offline.

2 Likes

That piece of automation code switches off every light and switch entity. Specially the last one is quite dangerous. Know what code does before running it is really key here.