binary_sensor:
  - platform: gpio
    id: bin1
    pin: 1

alarm_control_panel:
  - platform: template
    id: alarmcontrolpanel1
    name: Alarm Panel
    codes:
      - "1234"
      - "5678"
      - "0000"
    requires_code_to_arm: true
    arming_home_time: 1s
    arming_night_time: 1s
    arming_away_time: 15s
    pending_time: 15s
    trigger_time: 30s
    binary_sensors:
      - input: bin1
        bypass_armed_home: true
        bypass_armed_night: true
        bypass_auto: true
    on_state:
      then:
        - lambda: !lambda |-
            ESP_LOGD("TEST", "State change %s", LOG_STR_ARG(alarm_control_panel_state_to_string(id(alarmcontrolpanel1)->get_state())));
  - platform: template
    id: alarmcontrolpanel2
    name: Alarm Panel 2
    codes:
      - "1234"
      - "9999"
    requires_code_to_arm: true
    arming_home_time: 1s
    arming_night_time: 1s
    arming_away_time: 15s
    pending_time: 15s
    trigger_time: 30s
    binary_sensors:
      - input: bin1
        bypass_armed_home: true
        bypass_armed_night: true
        bypass_auto: true
    on_disarmed:
      then:
        - logger.log: "### DISARMED ###"
    on_pending:
      then:
        - logger.log: "### PENDING ###"
    on_arming:
      then:
        - logger.log: "### ARMING ###"
    on_armed_home:
      then:
        - logger.log: "### ARMED HOME ###"
    on_armed_night:
      then:
        - logger.log: "### ARMED NIGHT ###"
    on_armed_away:
      then:
        - logger.log: "### ARMED AWAY ###"
    on_triggered:
      then:
        - logger.log: "### TRIGGERED ###"
    on_cleared:
      then:
        - logger.log: "### CLEARED ###"
