Best method to turn off all when leaving the house

I set up an automation that uses a multicast and multiple actions to turn off a bunch of devices at the press of a button when leaving the house. (I realize presence detection might do the same…)

The automation is intermittent. Sometimes it works, sometimes not. I do not know if it is the multicast or something else. At one point, I put delays between the actions thinking there was too much traffic on the zwave network.

Question is should I ditch that list of actions and set up a scene, or take some other path?

- alias: away button
  trigger:
  - platform: state
    entity_id: switch.garage_away
    to: 'on'
  action:
    - service: zwave_js.multicast_set_value
      target:
        entity_id:
        - light.garage_hall         #Zen30
        - light.guest_bath          #Zen30
      data:
        command_class: '38'
        property: targetValue
        value: 0
    - delay: '00:00:01'
    - service: zwave_js.multicast_set_value
      target:
        entity_id:
        - light.kitchen_recessed   #GE dimmer
        - light.living_east        #GE dimmer
        - light.living_west        #GE dimmer
        - light.screened_porch     #GE dimmer
        - light.master_tub         #GE dimmer
        - light.us_hallway         #GE dimmer
        - light.us_office          #GE dimmer
      data:
        command_class: '32'
        property: targetValue
        value: 0
    - delay: '00:00:01'
    - service: light.turn_off
      entity_id:
        - light.master_bath_red    #GE switch
        - light.ds_office          #Zen27
        - light.zen74_master_closet        
    - delay: '00:00:01'
    - service: input_boolean.turn_off
      entity_id:
        - input_boolean.pump_1_motion_time
        - input_boolean.pump_1_request
        - input_boolean.pump_2_request
    - delay: '00:00:01'
    - service: switch.turn_off
      entity_id: 
        - switch.stairs           #Zen21  
        - switch.pump1            #wifi
        - switch.pump2            #wifi
        - switch.garage_away      #Zen30
    - service: timer.start
      entity_id: timer.away_delay
    - delay: '00:00:02'
    - service: light.turn_off
      entity_id:
        - light.garage_bay

Do you know if the automation runs at all (check traces where it stops) when it is not triggering the lights off? Are you certain the button press is registered? I don’t use Z-Wave, I use Zigbee, but I have grouped the lights and switches and target those two groups when leaving the house.

When I’m away I use labels to turn off devices, for example for my Zigbee devices the label is “Zigbee off when away”:

alias: When Leaving
sequence:
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      label_id: valve
  - action: switch.turn_off
    target:
      label_id:
        - zigbee_off_when_away
    data: {}
  - action: light.turn_off
    data: {}
    target:
      label_id:
        - zigbee_off_when_away

Don’t use the multicast commands. It causes more problems than it solves. Group the lights and target the groups.

This is what I use:

description: "Gone turn off"
triggers:
  - trigger: zone
    entity_id: device_tracker.pixel_9
    zone: zone.Home
    event: leave
    enabled: true
  - trigger: state
    entity_id:
      - automation.house_not_occupied
    for:
      hours: 0
      minutes: 5
      seconds: 0
    to: "on"
conditions:
  - condition: template
    value_template: |-

      {{states('input_text.guest_mode') == '0'}}
    enabled: true
actions:
  - type: turn_off
    device_id: 0e32d9a7f1f910c354e0297306b92126
    entity_id: light.bathroom_switch
    domain: light
  - type: turn_off
    device_id: 5912f084c57e0d03f048cd563c8ae5b5
    entity_id: switch.kitchen_induction_cooktop_on_off
    domain: switch
  - target:
      entity_id: scene.basement_lights_off
    metadata: {}
    action: scene.turn_on
    data: {}
  - target:
      entity_id: scene.cellar_lights_off
    metadata: {}
    action: scene.turn_on
    data: {}
  - data:
      skip_condition: false
    target:
      entity_id: automation.kitchen_lights_hold_off
    action: automation.trigger
  - type: turn_off
    device_id: 53761f89e1aee91a317b9f41b5b7ac9e
    entity_id: 3fd4835b67525b99bf73d76bb2ce2d8e
    domain: light
  - type: turn_off
    device_id: b199cd01bd8ae7c0a50e479abef19305
    entity_id: switch.sofa_3
    domain: switch
    enabled: false
  - type: turn_off
    device_id: 9a621f60e6581766f95a794aff9869d1
    entity_id: f867ac5509bb747965484b821cdf5005
    domain: switch
    enabled: true
  - metadata: {}
    target:
      entity_id: scene.dresser_off
    action: scene.turn_on
    data: {}
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id:
        - light.zooz_undercounter_switch_5
  - type: turn_off
    device_id: 22aecddc65ba56efd895a4dabc8ee69a
    entity_id: ea559655b3d993f6a555103c0b5153ac
    domain: light
    enabled: true
  - type: turn_off
    device_id: d5064b29cb0fa75dc4bcc6828227f7ad
    entity_id: 79eb1890d02c7985ef04c542bc122205
    domain: switch
    enabled: false
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.bedroom
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.bathroom_window_fan_on_off
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: light.sofas
mode: single