Help debugging why my lights didn't turn off

I’d like to understand how to write an automation that can reliably turn off multiple lights.

I had scheduled a script to run a light show after turning off the lights temporarily on new years eve. Unfortunately, in spite of testing this in advance, the “turn off the lights” part failed me at show time.

In particular, I have a service call below which ended up only turning off one light:

service: light.turn_off
data: {}
target:
  entity_id:
    - light.kitchen_and_family_recessed_lights
    - light.dimmer_dry_contact_relay_19
    - light.living_room_recessed_lights
    - light.dimmer_dry_contact_relay_2
    - light.dimmer_dry_contact_relay_3

The trace timeline simply shows

...
Light: Turn off Kitchen and Family Recessed Lights, Dining ceiling, Living Room Recessed Lights, Laundry Hallway Dimmer, Sink Light
(light.dimmer_dry_contact_relay_2) turned off

9 seconds later
...

Here’s the full downloaded trace: { "trace": { "last_step": "sequence/9", "run_id": "91f8a33248117183 - Pastebin.com

I’ve seen this before. It’s kind of like the commands to turn off all the lights get lost in the mix and doesn’t always complete.

There’s no way to troubleshoot it unless you have some lower level debugging set up in zwave, zigbee, etc. to see where the comms got messed up.

You could try to set up smaller groups of lights and have more service calls to see if it makes it more reliable.