Alarm panel control code just to disarm

I would like to use the code just to disarm the alarm but no to arm I tried this but is invalid configuration

alarm_control_panel:

  • platform: manual
    name: ALARMA CASA
    code_template: 1234
    from_state: armed
    to_state: disarmed
    pending_time: 30
    delay_time: 20
    trigger_time: 4
    disarmed:
    trigger_time: 0
    armed_home:
    pending_time: 0
    delay_time: 0

Can you not just put a button on the interface that sets the alarm?

Thank you but the reason why I want to arm without Code is because I Wil like to Connect by Google home, but just to arm.

I use this Alarm System it allows to set without code and only require on disarm, plus you get a nice looking access panel.

You can expose the button to GH. My alarm arms automatically when the house is empty, it’s just how you choose to use it.

i think this is a valid question (mostly as I’ve been asking a few people the same thing).

Using a code for the alarm requires it for changing all states of the alarm_control_panel
One can build automations and include the alarm code.

However one suggestion for the alarm_control_panel would be a setting that allows the user to specify what states require the code, (see below code_required_state) - this would allow people to chose, ie if there are kids in the house and you want to avoid them accidentally arming, or if you decide you just need a code to disarm the system.

This would be very useful for those who want to use custom alarm cards (lovelace or classic UI) and don’t know how to customize those.

alarm_control_panel:
  - platform: manual
    name: Home Alarm
    code: 1234
      code_required_state: disarm, arm_away
    pending_time: 30
    delay_time: 20
    trigger_time: 4
    disarmed:
      trigger_time: 0
    armed_home:
      pending_time: 0

thoughts?

I think you are all over thinking this an awful lot.

You can decide already what needs the code and what doesn’t.

When everyone leaves my house, the alarm sets. I don’t have to drive back home to punch the code in first. If you want this to be a button on the interface, then you can. If you want this to be controllable from Alexa / GH you can. If you want this to be automatic every 7th Thursday but only if you boiled the kettle twice that morning, you can.

the issue is more around the UI (and if you have UI panels in the house, Custom ui tiles, lovelace buttons, custom alarm cards for either ui). so i go back to the point that it would be good to use the code to disarm but NOT to arm.

In theory (assuming your automations and rules are 100% accurate and pick up every scenario) - you will never see the ‘disarm’ button in the house panels (as you will have disarmed the house).
same (also in theory) for the cleaners and any guests.

Now a burglar breaks in the house and is presented with a big green button saying ‘Disarm’. [so you need to remove the code from the custom alarm panel if you don’t use a code]

My question was should this be a UI customization (and tough for those who cant write their own code) or is this something that could be implemented into alarm_control_panel ?

Thank you for your replys I Will try with UI customization

Your idea is correct, but your template is not correct.
Use this setup, it works:

- platform: manual
  name: Home Alarm
  code_template: >-
          {% if is_state('alarm_control_panel.home_alarm', 'armed_away') %}
            1234
          {% elif is_state('alarm_control_panel.home_alarm', 'armed_home') %}
            1234
          {% elif is_state('alarm_control_panel.home_alarm', 'armed_night') %}
            1234
          {% endif %}
  pending_time: 12
  delay_time: 20
  trigger_time: 4
  disarmed:
    trigger_time: 0
  armed_home:
    pending_time: 0
    delay_time: 0

No code needed when arming, only when disarming. The keypad stays visible by the way, but you don’t have to enter the code.

1 Like

@Remco_Timmer Are you using this setup now? When I try this my keypad disappears and when I click disarm the service call fails with this message in the logs: Invalid code given for disarmed. Any thoughts?

I see the same behavior that krinehart describes. If I use code_template, the alarm panel keypad disappears and there is no way to change the alarm’s state

I confirm that it doesn’t work
Any update?
Thanks

There is a new option introduced: code_arm_required: false

1 Like

That is great. Is there also a way to have text code?
Thanks

Not sure what you mean?

What I mean is to use a string code instead of a number code.
Basically an alphanumeric password

Ah, no idea, just try a string for the code? :wink:

The code of @Remco_Timmer using code_template works for me. But I also witness the vanishing keypad as soon as I use code_template instead of code. The Alarm Control Panel card does in fact work correctly. But you have to enter the code through the normal keyboard.

I guess this is a bug so I filed an issue here:

@krinehart: If your PIN code does not match when using code_template, maybe you have added quotes in the template around the code. In this case the quotes will become part of the code and you must enter them too. Leave any quotes out.