Alarm Code

Ok, what am I missing? I am trying to have an input boolean to activate when I have guests visiting that would prevent the alarm from automatically alarm when both phones are detected as away. However the alarm seems to arm whether the input boolean is on or off. Thoughts?

Here is the code.

  • alias: Alarm Set Away
    initial_state: true
    trigger:
    • platform: state
      entity_id: group.all_phones
      from: home
      to: not_home
      condition:
      condition: or
      conditions:
      • condition: state
        entity_id: ‘input_boolean.sample1’
        state: ‘off’
      • condition: state
        entity_id: ‘input_boolean.sample2’
        state: ‘off’
        action:
    • service: alarm_control_panel.alarm_arm_away
      data:
      entity_id: alarm_control_panel.alarm
      code: !secret alarm_code

Read the blue banner at the top of the page and edit your post accordingly. Then we might be able to help.

- alias: Alarm Set Away
  initial_state: true
  trigger:
  - platform: state
    entity_id: group.all_phones
    from: home
    to: not_home
  condition:
    condition: or
    conditions:
    - condition: state
      entity_id: 'input_boolean.sample1'
      state: 'off'
    - condition: state
      entity_id: 'input_boolean.sample2'
      state: 'off'
  action:
  - service: alarm_control_panel.alarm_arm_away
    data:
      entity_id: alarm_control_panel.alarm
      code: !secret alarm_code

There’s nothing wrong with the way your automation is written.

If either input boolean sample1 or sample2 are off the action will execute. i.e. for the automation not to occur both input booleans must be on. Is this what you are seeing occur, and is this what you want?

Figured it out. I had my condition logic backward. Since I want the automation to fire only when both input booleans are off, I need the AND condition.

  condition:
    condition: and
    conditions:
    - condition #1
    - condition #2

Using OR logic, both input booleans need to be on in order to stop the automation based on conditions. Since generally I only have one condition on at a time, it will fail the the condition screen every time. Changing to AND only allows the automation to fire when both input booleans are off which is what I wanted.

Hopefully someone will find this helpful.