I’m trying to implement a simple security alarm with multiple control buttons that should a) turn off the alarm if it’s already fired and b) toggle ‘armed’ status of the system if there is no ongoing alarm. Current setup is like following:
input_boolean:
arm_status:
name: Arm Status
initial: off
alarm_bell:
name: Alarm Bell
initial: off
automation:
- alias: Security buttons turn off alarm
trigger:
# multiple button triggers, all work fine
condition:
condition: state
entity_id: input_boolean.alarm_bell
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.alarm_bell
- alias: Security buttons toggle armed status
trigger:
# the same long triggers block
condition:
condition: state
entity_id: input_boolean.alarm_bell
state: 'off'
action:
- service: input_boolean.toggle
entity_id: input_boolean.arm_status
I wonder if I can “merge” these two automations into one. I know from documentation that conditions can be used in action, but as I understood, they can only stop actions at certain point when condition is false, while I need to run different action otherwise. Thanks.