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.
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 ?
@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
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.