Turn off Alarm before opening the garage door

My current card is set to to use garage door zone to open the garage door (by tapping it once). However, at times I forget to disarm my alarm before opening the door and that triggers the alarm. Can someone suggest how to incorporate the condition to check if the alarm is on to first disarm before trigger the garage open call service:

type: vertical-stack
view_layout:
  position: main
cards:
  - type: alarm-panel
    entity: alarm_control_panel.partion_1
    states:
      - arm_home
      - arm_away
    name: Alarm
  - type: custom:vertical-stack-in-card
    cards:
      - title: Sensors
        type: glance
        show_header_toggle: false
        state_color: true
        entities:
          - entity: binary_sensor.zone_3
          - entity: binary_sensor.zone_4
          - entity: binary_sensor.zone_2
          - entity: binary_sensor.zone_9
            entity_id: alarm_control_panel.partion_1
            name: Garage door
            state:
              - value: open
                color: rgb(5, 147, 255)
              - value: Closed
                color: rgb(189, 255, 5)
            tap_action:
              condition:
                condition: state
                entity_id: alarm_control_panel.partion_1
                state:
                  - "armed_away"           
              action: call-service
              service: envisalink.alarm_keypress
              service_data:
                keypress: D
                entity_id: alarm_control_panel.partion_1
  - type: entity
    entity: sensor.partion_1_keypad
    icon: mdi:alarm-panel
    state_color: true

You need to make an automation or script to do that.
You could have a script that you trigger from your card that checks the alarm and disarms if needed then opens the door.
This should disarm the alarm then open the door

alias: New Script
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ states(''alarm_control_panel.partion_1'') [0:3] == "arm" }}'
        sequence:
          - service: alarm_control_panel.alarm_disarm
            data:
              code: '1234'
            target:
              entity_id: alarm_control_panel.partion_1
    default: []
  - service: 'open garage door service'
    data: {}
mode: single
1 Like

I’ve made change to my card panel:

tap_action:
  action: script.alarm_check

In the script file:

alarm_check:
  alias: alarm check sequence
  sequence:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ states('alarm_control_panel.partion_1')=='arm'}}"
      sequence:
        - service: alarm_control_panel.alarm_disarm
          data:
            code: '1234'
          target:
            entity_id: alarm_control_panel.partion_1
  - service: envisalink.alarm_keypress
    data:
      keypress: D
      entity_id: alarm_control_panel.partion_1

any suggestion please ?

Use the gui to add that service call

Can’t use UI as I’m using custom stack card :frowning: . Additionally they key press function has to be in the script in the sequence I’ve created above isn’t it ?

The script editor, not the dashboard.
If you have a custom card doesn’t make a difference for the script editor

minor change in the value_template has fixed the problem. All working fine now :slight_smile:
Thanks,