Creating Switches for Alarm Panel

I’ve setup the envisalink alarm system integration and all is working well with that with being able to arm / disarm with entering my code. I am now looking to create shortcuts that will allow me to click a toggle to arm (away) / arm (stay) / and disarm without entering my code each time. I’ve seen mention of automation rules, however, I don’t want automation at this point, only the ability to have it enabled at the click of a button.

This is one that I’ve tried but showing its invalid on the home screen:

sensor:
  - platform: state
    entity_id: input_boolean.arm_alarm
    to: 'on'
    action:
      service: alarm_control_panel.alarm_arm_away
      data:
        entity_id: alarm_control_panel.home
        code: XXXX

This is under the ‘switch’ section. I already have a ‘switch’ for my Wake On Lan and since that was a toggle, I thought this would be similar.

Once I set this up and get it working as desired, I would be looking towards the automation portion but I’ve seen examples of that and think I could get that running. Could someone point me in the right direction?

Chip, to fix the formatting display, highlight the entire code block and then press the preformatted code button:

1 Like

Got it - it’s showing the code properly now.

I’ll be creating one of these for each of the status’

Arm (Away)
Arm (Stay)
Disarm

so I’m looking to see the proper syntax, commands, and even where to place it in the configuration file. I’ve tried under automation and switch so far, but I’m not sure the right place for a simple toggle, inclusive of the code required to pass along. Any help is greatly appreciated. Thanks

You might want to try checking out the dev page services, which include Arm, Stay arm and arm. This is my script to restart HA, stay arm and disarm, the script can be put on the front page under groups.

script:
  restart_ha:
    alias: Restart HA
    sequence:
      - alias: Restart HA
        service: homeassistant.restart

  homearm:
    alias: Home Arm
    sequence:
        service: alarm_control_panel.alarm_arm_home
  disarm:
    alias: Disarm
    sequence:
        service: alarm_control_panel.alarm_disarm

Hi there,

This looks to have done it! I added the data commands for the particular entity and the code as per below and was able to get setup with Arm Home, Arm Away, Disarm. I may need to do some additions to where if I switch it remotely from Arm Home to Arm Away that it needs to disarm first as the panel won’t accept switching directly without first disarming but this is a great start. Thanks very much for your help!

script:
  homearm:
    alias: Arm Home
    sequence:
      service: alarm_control_panel.alarm_arm_home
      data:
        entity_id: alarm_control_panel.home
        code: XXXX