Alarm_Control_Panel - underlying sensors and state values?

Just installed and connected an AlarmDecoder AD2Pi device this morning, and while it’s working just peachy-keen, I’d like to script some automations based on the underlying alarm status value of either:

  • disarmed
  • armed - away
  • armed - stay

The only item I see remotely similar to this is the ‘ready’ attribute, which would indicate only armed or disarmed. Because I can see the badge atop the alarm control panel in Lovelace, I know it’s there, somewhere. :face_with_raised_eyebrow:

Hrmmm, maybe it’s this topic, where I found the following script:

          {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 %}

Just documenting this for anyone else’s benefit. Will post more if I come up with anything remotely useful. :wink:

This is the template sensor I created for use in other groups of sensors/switches. I have placed custom icon PNG files into the ‘www’ directory beneath the home assistant user directory, so they are found as ‘/local/???.png’ by the UI webserver.

sensor:
#
# Alarm Status Text
# with custom icons
#
  - platform: template
    sensors:
      my_alarm_state_text:
        friendly_name: "Alarm Status"
        value_template: >-
          {% if   is_state('alarm_control_panel.alarm_panel', 'armed_away')  %}
            Armed - Away
          {% elif is_state('alarm_control_panel.alarm_panel', 'armed_home')  %}
            Armed - Home
          {% elif is_state('alarm_control_panel.alarm_panel', 'armed_night') %}
            Armed - Night
          {% else %}
            Disarmed
          {% endif %}
        entity_picture_template: >-
          {% if   is_state('alarm_control_panel.alarm_panel', 'armed_away')  %}
            /local/state_armed_away.png
          {% elif is_state('alarm_control_panel.alarm_panel', 'armed_home')  %}
            /local/state_armed_home.png
          {% elif is_state('alarm_control_panel.alarm_panel', 'armed_night') %}
            /local/state_armed_home.png
          {% else %} 
            /local/state_disarmed.png
          {% endif %}