Help with automation turning off all lights

I have the below automation which runs at night when I turn off my living room TV.

It’s meant to turn off all the lights inside/outside and then turn on three specific lights for 7 mins (let the dog out, navigate up to bed).

The prob is the first step of turning off all lights (understandably) takes awhile cause that’s a lot of lights. So it may take 30-60 secs for the three lights to turn on which kind of defeats the purpose.

I can’t put the “all lights off” scene second since that’ll turn off the lights that I had turn on. I can’t put it at the end either (which is what I did at first) because my wife “doesn’t trust” that they’ll all turn off haha.

Maybe there’s no way around it but I was curious if anyone had suggestions on how to better fine tune it.

Thanks!

alias: "Evening: Living Room TV - Off"
description: ""
triggers:
  - entity_id:
      - remote.living_room_tv
    to: "off"
    trigger: state
    from: "on"
conditions:
  - condition: time
    after: "21:30:00"
actions:
  - action: scene.turn_on
    metadata: {}
    target:
      entity_id:
        - scene.all_lights_off
    data: {}
  - action: light.turn_on
    data: {}
    target:
      entity_id:
        - light.deck_flood_light
        - light.upstairs_hallway_lights
        - light.kitchen_main_lights
  - delay:
      hours: 0
      minutes: 7
      seconds: 0
      milliseconds: 0
  - action: light.turn_off
    data: {}
    target:
      entity_id:
        - light.deck_flood_light
        - light.upstairs_hallway_lights
        - light.kitchen_main_lights
mode: single

what protocol is your lights?

Majority are Z-Wave switches with a few Zigbee ones for my Hue bulbs…if that’s what you mean by protocol. Sorry, I’m still an HA noob

Yes, well, you can attempt to get multicast working. It won’t be an easy road but all your zwave lights will turn on/off at the same time.

Multicast is best because it is a better effect when (almost) everything turns off at once, but if that doesn’t work out for you, try creating a “most lights off” or a “get to bed” scene that doesn’t include the three specific lights. Then it could be the second action without affecting those three.

Make a new scene which turns off everything except those “three specific lights”, then run that scene and the other actions in parallel.

actions:
  - parallel:
      - action: scene.turn_on
        metadata: {}
        target:
          entity_id:
            - scene.all_lights_off_except_below_three
        data: {}
      - sequence:
          - action: light.turn_on
            data: {}
            target:
              entity_id:
                - light.deck_flood_light
                - light.upstairs_hallway_lights
                - light.kitchen_main_lights
          - delay:
              hours: 0
              minutes: 7
              seconds: 0
              milliseconds: 0
          - action: light.turn_off
            data: {}
            target:
              entity_id:
                - light.deck_flood_light
                - light.upstairs_hallway_lights
                - light.kitchen_main_lights

Or just make it easy on yourself and turn off all lights at the very end instead…

1 Like