If all lights on -> all lights off

In the event of a power failure, all Hue lamps will light up when power is restored. I noticed this the other day when I blew a fuse.

What would be the most elegant way for HA to turn off all the lights after he noticed that all the lights were on?

Create a sensor with all devices (all-lights-on)?

Are these connected via the Hue integration? If so, you can set the power on behavior in the Hue app to stay off after a power outage.

No, all lights are integrated with the Conbee II (Phoscon)

I have created a group in Phoscon-GW which contains all lamps (alle_lichter).
I can’t take this goup as a trigger because they show the status “on” as soon as even one of them is on, but I use them to turn off all lights.

I took one light as trigger and then added some as AND conditions, which are never all switched on at the same time in normal case (I was too lazy to add all my lamps).

If the rule applies, after 10 seconds all Hue lamps and for safety’s sake two others that are included via smart-life will be switched off (the trigger light has to be 5 seconds on and then after another 5 seconds the rule will be applied).

 - id: '16022293xxxxx'
   alias: all lights on -> all lights off
   description: hue lights off after power failure
   trigger:
   - platform: state
     entity_id: light.dimmable_light_flurlicht
     to: 'on'
     for: '5'
   condition:
   - condition: and
     conditions:
     - condition: state
       entity_id: light.badezimmerlicht
       state: 'on'
     - condition: state
       entity_id: light.abstellkammer
       state: 'on'
     - condition: state
       entity_id: light.dimmable_light_aussenlicht
       state: 'on'
     - condition: state
       entity_id: light.dimmable_light_kellerlicht
       state: 'on'
     - condition: state
       entity_id: light.kabuff
       state: 'on'
     - condition: state
       entity_id: light.extended_color_light_esstischl
       state: 'on'
     - condition: state
       entity_id: light.dimmable_light_kuechenlicht
       state: 'on'
   action:
   - delay: '5'
   - type: turn_off
     device_id: 677af01f0a0211eb9ea8d368c8cxxxxx
     entity_id: light.alle_lichter
     domain: light
   - type: turn_off
     device_id: c400ceef000d11eb9dd99f9e89dxxxxx
     entity_id: light.fernsehlampe
     domain: light
   - type: turn_off
     device_id: c400854b000d11eb80abede39e7xxxxx
     entity_id: light.schreibtischlampe
     domain: light
   mode: single