Automation Actions Slow to Execute

This automation is triggered immediately. The first service lock.lock executes immediately. However, the rest of the actions take up to 30-45 seconds to execute. The switches and light are all GE Z Wave switches and dimmer respectively. At first I thought it was a polling problem, so I added these devices to my zwave: section and added polling. That did’t fix the issue. Then I thought it might be the condition: within the actions that was slowing it down, so I moved the service light.turn_on ahead of it and it still took 30-45 seconds for the light to turn on.

- id: alarm_disarmed_actions
    alias: 'Alarm Disarmed Actions'
    hide_entity: True
    trigger:
    - platform: state
      entity_id: alarm_control_panel.ha_alarm
      to: 'disarmed'
    action:
    - service: lock.unlock
      entity_id: lock.garage_door_lock_locked
    - condition: or
      conditions:
      - condition: sun
        before: sunrise
        before_offset: "00:15:00"
      - condition: sun
        after: sunset
        after_offset: "-00:30:00"
    - service: switch.turn_on
      entity_id:
        - switch.living_room_lamp_switch
        - switch.under_cabinet_lights_switch
    - service: light.turn_on
      data:
        entity_id: light.kitchen_light_level
        brightness: 255

I have a few other automations that turn lights/switches on/off and those execute immediately. The only real difference between the two is the position of the conditions. It can’t be a problem with condition: sun or the sun platform as that works. Maybe it’s a problem with having conditions inside an action of an automation? Here’s another automation, and this one works as expected:

  - id: night_light_on
    alias: 'Night Light On'
    trigger:
    - platform: state
      entity_id: binary_sensor.motion_detector_sensor
      to: 'on'
    condition:
      condition: and
      conditions:
      - condition: state
        entity_id: alarm_control_panel.ha_alarm
        state: 'armed_home'
      - condition: or
        conditions:
        - condition: sun
          before: sunrise
          before_offset: "00:15:00"
        - condition: sun
          after: sunset
          after_offset: "-00:30:00"
    action:
    - service: light.turn_on
      data:
        entity_id: light.kitchen_cabinet_lights
        brightness: 128
        rgb_color: [255, 82, 11]
    - service: light.turn_on
      data:
        entity_id: light.kitchen_light_level
        brightness: 64
    - service: light.turn_on
      data:
        entity_id: light.haswitchplate
        brightness: 128
    - service: script.turn_off
      entity_id: script.night_light

I just tried it on my system and it works immediately so it may be to do with your zwave (mine is rf433 switches).

I’m wondering if it might have to do with the z wave lock I have. It’s a kwikset and it’s fairly slow to update its status to HA. It responds to commands immediately but reports back status pretty slow. I’ll try removing that from the actions and see if that changes the speed of the automation.

yep, it’s my lock. if I comment out the lock service and entity id, the automation actions execute immediately and the lights turn off/on. as soon as I put the lock back into the actions it takes anywhere from 15-30 seconds to fire the rest of the actions. Now to figure out if it’s a Z Wave polling issue or something with the lock service in HA.