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