Hi everyone,
I have written a most excellent automation that makes the lights red in my house when you arrive home and the alarm goes from away to pending, then recalls the snapshot scene to return the lights to their previous state.
The issue is that when the state of alarm disarmed is triggered from the alarm home state change it will recall the snapshot scenes, which can turn the lights on/off at undesired times. I haven’t found a condition to determine the difference between disarmed from away and disarmed from home. Any ideas?
Here’s my automation code for those of you who are interested:
alias: Time to Disarm the Alarm
description: ""
trigger:
- platform: mqtt
topic: >-
/alarm/state
payload: pending
id: pending
- platform: mqtt
topic: >-
/alarm/state
payload: disarmed
id: disarmed
condition:
- condition: trigger
id:
- pending
- disarmed
action:
- choose:
- conditions:
- condition: trigger
id:
- pending
sequence:
- service: scene.create
data:
scene_id: alarm_disarm_previous_kitchen
snapshot_entities: light.kitchen_island
- service: scene.create
data:
scene_id: alarm_disarm_previous_bar
snapshot_entities: light.bar
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 20
- parallel:
- service: light.turn_on
data:
brightness_pct: 100
color_name: red
flash: short
target:
area_id: bar
- service: light.turn_on
data:
rgb_color:
- 255
- 0
- 0
flash: short
target:
entity_id: light.kitchen_island
- conditions:
- condition: trigger
id:
- disarmed
sequence:
- parallel:
- service: scene.turn_on
data: {}
target:
entity_id:
- scene.alarm_disarm_previous_bar
- scene.alarm_disarm_previous_kitchen
mode: queued