Home Alarm (KNX) : State stay unknown, Not able to arm with a template control panel

Hello
I am from France and new to Home Assistant.
Sorry for my bad english!

I have a house with all lights, covers and Alarm in KNX. I have the Hager domovea Supervisor, but this is too closed : I can’t add my hue lights, zigbee sensors, …

So I started to migrate to HA.
Lights, Covers, Sensors are OK. But I have some problems with alarm (Hager alarm with TRC120 for dialog with KNX)…

What I did :
The on/off alarm zones were configured as switches in HA

knx:
  switch:
    - name: alarme ouvertures
      address: 4/0/0
      state_address: 4/0/1
    - name: alarme rdc
      address: 4/1/0
      state_address: 4/1/1

I created a group for that in groups.yaml

alarme:
  name: Alarme
  entities:
    - switch.alarme_ouvertures
    - switch.alarme_rdc

And a template binary sensor to have the state of my alarm

binary_sensor:
# Etat Alarme
  - platform: template
    sensors:
      etat_alarme:
        friendly_name: "Etat Alarme"
        #device_class: safety
        value_template: "{{ is_state('group.alarme', 'on') }}"

Ok, I have the state of my alarm, and I can turn on and turn off with an entity “group.alarme”.
But I want to secure that with the Alarm Control Panel and I have some issues…
To have the correct states in this control panel, I have configured a template :

alarm_control_panel:
  - platform: template
    panels:
      alarme_hager:
        value_template: "{{ states('binary_sensor.etat_alarme') }}"
        arm_home:
          - service: switch.turn_on
            data:
              entity_id: switch.alarme_ouvertures
        arm_away:
          - service: switch.turn_on
            data:
              entity_id: 
                - switch.alarme_ouvertures
                - switch.alarme_rdc
        disarm:
          - service: switch.turn_off
            data:
              entity_id: 
                - switch.alarme_ouvertures
                - switch.alarme_rdc

But when I use it in an Alarm Panel Card, I have just the disarmed button, and the state stay always Unknown …

Conf :

State, just one button :


alarm_ha_state

Have you an idea ?

Thanks in advance!

I found a solution :
I created a sensor wich return the good state (state of the real alarm) like that :

sensor:
# Etat Alarme
  - platform: template
    sensors:
      statut_alarme:
        friendly_name: "Statut Alarme"
        entity_id: binary_sensor.etat_alarme
        value_template: >-
          {% if is_state('switch.alarme_ouvertures', 'off') and is_state('switch.alarme_rdc', 'off') %}
            disarmed
          {% elif is_state('switch.alarme_ouvertures', 'on') and is_state('switch.alarme_rdc', 'off') %}
            armed_home
          {% elif is_state('switch.alarme_ouvertures', 'on') and is_state('switch.alarme_rdc', 'on') %}
            armed_away          
          {% else %}
            unavailable
          {% endif %}
        icon_template: >
          {% if is_state('binary_sensor.alarm_arm_status', 'off') %}
            mdi:lock-open
          {% elif is_state('binary_sensor.alarm_arm_status', 'on') %}
            mdi:lock
          {% else %}
            mdi:lock-alert
          {% endif %}

And now with this template I can ar and disarm my real KNX alarm. Also now, I will try to add some aqara sensors to trigger my alarm.

alarm_control_panel:
  - platform: template
    panels:
      alarme_hager:
        name: 'Alarme Hager'
        code_arm_required: true
        value_template: "{{ states('sensor.statut_alarme') }}"
        arm_home:
          - service: switch.turn_on
            data:
              entity_id: switch.alarme_ouvertures
        arm_away:
          - service: switch.turn_on
            data:
              entity_id: 
                - switch.alarme_ouvertures
                - switch.alarme_rdc
        disarm:
          - condition: template
            value_template: "{{ code == 'mon_code_num' }}"
          - service: switch.turn_off
            data:
              entity_id: 
                - switch.alarme_ouvertures
                - switch.alarme_rdc