Automation- Hue all except one lamp

Hi,

I use the Hue brdige and have configuread all my rooms and lamps in it. HomeAssistant is connected to the bridge and shows all devices properly.

Now I am trying to create an automation which switches off all lights when sunrise happened. But there ist a single device which should stay on. What is the best way to do so?

As it is a little bit an effort to tell the automation configuration to switch off every single room- is there the possibility to switch off everything? How do I get this?

About the single light not to be powered off I can use another automation which switches it back on a couple of minutes later based on an offset.

But I need the wildcard entry for Hue. Currently it is for a single device as follows:

alias: Bei Sonnenaufgang Licht aus
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: 0
condition: []
action:
  - type: turn_off
    device_id: 347026cac69854e20d28f8b6e9af0231
    entity_id: light.eg_eingangsbereich
    domain: light
mode: single

Any ideas here?

/KNEBB

You can use


service: light.turn_off
target: 
  entity_id: all

1 Like

Hi,
thanks! Using β€œall” as wildcard was too close to get the idea myself :wink:

I now have:

alias: Bei Sonnenaufgang Licht aus
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: 0
condition: []
action:
  - service: light.turn_off
    data: {}
    target:
      entity_id: all
mode: single

and

alias: Elektrozaun morgens an
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: "10"
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      device_id: b2f8cd81b534609bb60efe2cb5505b92
mode: single

I will check the next couple of days if it is working.
And just as some cosmetical issue: is it possible to integrate them into a single automation?

Thanks!

/KNEBB

You can define a delay of 10 sec. after the first service call and then add Elektrozaun as second service call in one automation.

Hi,

thanks again.

I was not aware the actions are executed ordered. Now it looks fine:

alias: Bei Sonnenaufgang Licht aus
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: "30"
condition: []
action:
  - service: light.turn_off
    data: {}
    target:
      entity_id: all
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: light.turn_on
    data: {}
    target:
      device_id: b2f8cd81b534609bb60efe2cb5505b92
mode: single

/KNEBB