$150.00 Bounty: Alarm Template disarming without code

Hi All,

I implemented Alarm_Control_Panel (template) and I am having an issue with enforcing a code to arm/disarm. This appears to be an ongoing issue - however, there is a workaround - but the level of documentation isn’t enough to implement the workaround. I have searched and searched but have been unsuccessful.
Workaround: Docs on template alarm panel implement alarms requiring no code · Issue #23124 · home-assistant/home-assistant.io · GitHub
Another page that I reviewed: Esp32 home alarm system with home assistant and esphome · GitHub

Configuration.yaml:

alarm_control_panel:
  - platform: template
    panels:
      safe_alarm_panel:
        name: "Home Alarm"
        value_template: "{{ states('alarm_control_panel.lyric_alarm_system') }}"
        arm_away:
          - condition: template
            value_template: !secret evaluate_code
          - service: alarm_control_panel.alarm_arm_away
            entity_id: alarm_control_panel.lyric_alarm_system
            data:
              code: !secret alarm_code
        arm_home:
          - condition: template
            value_template: !secret evaluate_code
          - service: totalconnect.arm_home_instant
            entity_id: alarm_control_panel.home
            data:
              code: !secret alarm_code
        disarm:
          - condition: template
            value_template: !secret evaluate_code
          - service: alarm_control_panel.alarm_disarm
            entity_id: alarm_control_panel.lyric_alarm_system
            data:
                code: !secret alarm_code

secrets.yaml:

alarm_code: 0000
evaluate_code: "{{ code == 0000 }}"

In the past a configuration similar to what is provided on the integrations alarm template page worked. However, I could click disarm without any code and the alarm would disarm. As you can imagine that doesn’t work with a tablet that is freely available.

With the configuration provided above, nothing happens. I can enter the code and click one of the arm buttons - does nothing. I can just click on one of the arm buttons, nothing happens.

I see nothing in the log related to this issue other than at one point in time having ‘0000’ in evaluate_code stated that it didn’t want extra characters. So I removed the two ’

For those of you curious on why I am using template, it is because I want to use the arm home instant service instead of arm home.


Now Information on the Bounty: $150.00 will be transferred into the Paypal account of the first person that either corrects this issue or provides the right yaml to fix the problem.

While I have been waiting for help, I decided to try to run this issue through Chat GPT. It came up with the following Yaml. However, the disarm action is still allowed without a code. Anyone?

alarm_control_panel:
  - platform: template
    panels:
      safe_alarm_panel:
        name: "Home Alarm"
        value_template: "{{ states('alarm_control_panel.lyric_alarm_system') }}"
        arm_away:
          - service: alarm_control_panel.alarm_arm_away
            target:
              entity_id: alarm_control_panel.lyric_alarm_system
        arm_home:
          - service: totalconnect.arm_home_instant
            target:
              entity_id: alarm_control_panel.home
        disarm:
          - service: alarm_control_panel.alarm_disarm
            target: 
              entity_id: alarm_control_panel.lyric_alarm_system
            data:
                code: !secret alarm_code

I have been digging further into this issue and I have come to the conclusion that no one appears to have a solution to this problem. Given this and the fact the examples show the ability to use a code - this is a major defect as it opens up so many safety issues. Since this is a safety issue it should be recommended to not use this integration as there are too many problems with it. Perhaps when the template capability is corrected this would be a good feature. Until then the $150.00 bounty is still available.

I would put these both into quotes to interpret them as strings.

Change this

alarm_code: 0000
evaluate_code: "{{ code == 0000 }}"

To this

alarm_code: ‘0000’
evaluate_code: "{{ code == ‘0000’ }}"

Hi PeteRage - perfect. That worked - it is the solution. Please direct message me your paypal information.

For those of you that are interested - the full configuration is:

Configuration.yaml

alarm_control_panel:
  - platform: template
    panels:
      safe_alarm_panel:
        name: "Home Alarm"
        value_template: "{{ states('alarm_control_panel.lyric_alarm_system') }}"
        arm_away:
          - service: alarm_control_panel.alarm_arm_away
            target:
              entity_id: alarm_control_panel.lyric_alarm_system
        arm_home:
          - service: totalconnect.arm_home_instant
            target:
              entity_id: alarm_control_panel.home
        disarm:
          - condition: template
            value_template: !secret evaluate_code
          - service: alarm_control_panel.alarm_disarm
            entity_id: alarm_control_panel.lyric_alarm_system
            data:
              code: !secret alarm_code

Secrets.yaml:

alarm_code: '0000'
evaluate_code: "{{ code == '0000' }}"