Konnected to ESP custom firmware but can't see why not all PIRs work

I’ve just migrated my Konnected alarm from the custom integration to ESP Home. I thought I’d try to compile my own firmware, but can’t see where I’ve gone wrong. Only the Kitchen PIR, Utility Room PIR and Tamper trigger. The rest do nothing. I’m new to ESP code, so I expect I’ve made every mistake going - and hoping someone will tell me where my mistake is.

####
# GENERAL SETTINGS
# Customize these variables to your preferences and needs
# more: https://esphome.io/guides/configuration-types.html#substitutions
substitutions:

  ####
  # NAME
  # By default, the name of the ESPHome device is "konnected-xxxxxx" where xxxxxx is a unique identifier. The device's
  # hostname on your network is also defined by the name, defaulting to "konnected-xxxxxx.local". Edit this variable to
  # customize the name and hostname. Note: only lowercase characters, numbers and hyphen(-) are allowed.
  name: konnected-xxxxxx
  friendly_name: Alarm Panel Pro
  project_name: konnected.alarm-panel-pro-ethernet
  project_version: "0.1.CUSTOM"

  # ETHERNET CONFIG
  # On the Alarm Panel Pro v1.5, v1.6 and v1.7 use LAN8720. On the v1.8 set this variable to RTL8201.
  ethernet_type: LAN8720

  sensor_debounce_time: 200ms
  warning_beep_pulse_time: 100ms
  warning_beep_pause_time: 130ms
  warning_beep_internal_only: "false"
  warning_beep_shared: "false"
  blink_on_state: "true"

  ####
  # ZONE MAPPING
  # Do not edit this section.
  zone1: GPIO4
  zone2: GPIO2
  zone3: GPIO15 
  zone4: GPIO13 
  zone5: GPIO18
  zone6: GPIO14
  zone7: GPIO33
  zone8: GPIO32
  zone9: GPIO36  # working
  zone10: GPIO39 # working
  zone11: GPIO34 # not tested
  zone12: GPIO35 # working
  alarm1: GPIO12
  alarm2: GPIO5
  out1: GPIO23
  out2: GPIO5
  status_led: GPIO3


  ####
  # CONNECTION MAPPINGS
  warning_beep_pin: $out1

####
# PACKAGES
# Each package includes the alarm panel feature
# Remove or comment out any packages that you do not need or want.
# If you're developing/installing locally, replace the github package line with the local package include above it.
packages:

  remote_package:
    url: https://github.com/konnected-io/konnected-esphome
    ref: master
    refresh: 5min
    files:

      ####
      # CORE
      # This package is required and sets up core features.
      - packages/core-esp32.yaml

      ####
      # ETHERNET
      # Enables ethernet connectivity.
      - packages/ethernet.yaml

      ####
      # MDNS
      # Enables the _konnected MDNS/zeroconf service advertisement needed for the Konnected App
      - packages/mdns.yaml

      ####
      # STATUS LED
      # Enables the onboard blue status LED as an activity/error indicator
      - packages/status-led.yaml

      ####
      # INPUT ZONES
      - packages/alarm-panel/zone1.yaml



      ####
      # WARNING BEEP
      # Enables a 'Warning Beep' entity, intended to be used with a piezo buzzer or other pulsing.
      # binary output This is implemented using the light component with strobe effect to create a 
      # repeated beeping sound or pulsing action that can be turned on via the _strobe_ effect.
      - packages/warning-beep.yaml
  
dashboard_import:
  package_import_url: github://konnected-io/konnected-esphome/alarm-panel-pro-esp32-ethernet.yaml@master
  import_full_config: false


####
# WEB SEVER
# Enables the built-in web server for viewing the device state, internals and controls via web browser
# on the same local network as the device.
web_server:
  include_internal: true

#### 
# LOGGER
# more: https://esphome.io/components/logger.html
logger:

####
# NATIVE API for HOME ASSISTANT
# Enables the native API for Home Assistant
# more: https://esphome.io/components/api.html
api:
  encryption:
    key: xxxxxxx

ota:
  - platform: esphome
    password: "xxxxxxx"

binary_sensor:

#2
  - platform: gpio
    id: sitting_room_pir
    name: Sitting Room PIR
    device_class: motion
    pin:
      number: $zone2
      mode: INPUT
    filters:
      - delayed_on_off: $sensor_debounce_time
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#3
  - platform: gpio
    id: front_door
    name: Front Door
    device_class: door
    pin:
      number: $zone3
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#4
  - platform: gpio
    id: drawing_room_pir
    name: Drawing Room PIR
    device_class: motion
    pin:
      number: $zone4
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#5
  - platform: gpio
    id: kitchen_door
    name: Kitchen Door
    device_class: door
    pin:
      number: $zone5
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#6
  - platform: gpio
    id: study_pir
    name: Study PIR
    device_class: motion
    pin:
      number: $zone6
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#7
  - platform: gpio
    id: upstairs_pir1
    name: Upstairs PIR 1
    device_class: motion
    pin:
      number: $zone7
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#8
  - platform: gpio
    id: upstairs_pir2
    name: Upstairs PIR 2
    device_class: motion
    pin:
      number: $zone8
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#9
  - platform: gpio
    id: utility_room_pir
    name: Utility Room PIR
    device_class: motion
    pin:
      number: $zone9
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#10
  - platform: gpio
    id: kitchen_pir
    name: Kitchen PIR
    device_class: motion
    pin:
      number: $zone10
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#11
  - platform: gpio
    id: panic
    name: Panic Alarm
    device_class: tamper
    pin:
      number: $zone11
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
#12
  - platform: gpio
    id: tamper
    name: Tamper
    device_class: tamper
    pin:
      number: $zone12
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led
      
  - platform: homeassistant
    id: ha_test
    name: HA Test
    entity_id: input_boolean.test_switch

switch:
  - platform: gpio
    id: siren1
    name: Siren 1
    icon: mdi:alarm-bell
    pin: $alarm1

#  - platform: gpio
#    id: buzzer
#    name: Buzzer
#    icon: mdi:bell-ring-outline
#    pin: $out1

alarm_control_panel:
  platform: template
  name: Alarm Panel
  id: acp1
  codes:
    - "1234"
  requires_code_to_arm: false
  arming_away_time: 0s
  arming_home_time: 0s
  pending_time: 15s
  trigger_time: 1min
 
  binary_sensors:
    - input: sitting_room_pir
      bypass_armed_home: true
      trigger_mode: instant

    - input: front_door
      trigger_mode: delayed

    - input: drawing_room_pir
      trigger_mode: instant

    - input: kitchen_door
      chime: true
      trigger_mode: instant

    - input: study_pir
      trigger_mode: instant

    - input: upstairs_pir1
      bypass_armed_night: true
      trigger_mode: instant

    - input: upstairs_pir2
      bypass_armed_night: true
      trigger_mode: instant

    - input: utility_room_pir
      bypass_armed_home: true
      bypass_armed_night: true
      trigger_mode: instant

    - input: kitchen_pir
      bypass_armed_home: true
      trigger_mode: instant

    - input: panic
      trigger_mode: instant_always

    - input: tamper
      trigger_mode: instant_always
    
  on_state:
    then:
      - lambda: !lambda |-
          ESP_LOGD("TEST", "State change %s", alarm_control_panel_state_to_string(id(acp1)->get_state()));
  on_triggered:
    then:
      - switch.turn_on: siren1
  on_cleared:
    then:
      - switch.turn_off: siren1
  on_ready:
    then:
     - lambda: !lambda |-
         ESP_LOGD("TEST", "Sensor ready change to: %s",
           (id(acp1).get_all_sensors_ready()) ? (const char *) "True" : (const char *) "False");
  on_chime:
    then:
     - lambda: !lambda |-
         ESP_LOGD("TEST", "Zone with chime mode set opened");

However, when using the basic code, all PIRs trigger:

####
# GENERAL SETTINGS
# Customize these variables to your preferences and needs
# more: https://esphome.io/guides/configuration-types.html#substitutions
substitutions:

  ####
  # NAME
  # By default, the name of the ESPHome device is "konnected-xxxxxx" where xxxxxx is a unique identifier. The device's
  # hostname on your network is also defined by the name, defaulting to "konnected-xxxxxx.local". Edit this variable to
  # customize the name and hostname. Note: only lowercase characters, numbers and hyphen(-) are allowed.
  name: konnected
  friendly_name: Alarm Panel Pro
  project_name: konnected.alarm-panel-pro-ethernet
  project_version: "1.2.1"

  # ETHERNET CONFIG
  # On the Alarm Panel Pro v1.5, v1.6 and v1.7 use LAN8720. On the v1.8 set this variable to RTL8201.
  ethernet_type: LAN8720

  sensor_debounce_time: 200ms
  warning_beep_pulse_time: 100ms
  warning_beep_pause_time: 130ms
  warning_beep_internal_only: "false"
  warning_beep_shared: "false"
  blink_on_state: "true"

  ####
  # ZONE MAPPING
  # Do not edit this section.
  zone1: GPIO4
  zone2: GPIO2
  zone3: GPIO15
  zone4: GPIO13
  zone5: GPIO18
  zone6: GPIO14
  zone7: GPIO33
  zone8: GPIO32
  zone9: GPIO36
  zone10: GPIO39
  zone11: GPIO34
  zone12: GPIO35
  alarm1: GPIO12
  alarm2: GPIO5
  out1: GPIO23
  out2: GPIO5
  status_led: GPIO3
  
  ####
  # CONNECTION MAPPINGS
  warning_beep_pin: $out1

####
# PACKAGES
# Each package includes the alarm panel feature
# Remove or comment out any packages that you do not need or want.
# If you're developing/installing locally, replace the github package line with the local package include above it.
packages:

  remote_package:
    url: https://github.com/konnected-io/konnected-esphome
    ref: master
    refresh: 5min
    files:

      ####
      # CORE
      # This package is required and sets up core features.
      - packages/core-esp32.yaml

      ####
      # ETHERNET
      # Enables ethernet connectivity.
      - packages/ethernet.yaml

      ####
      # MDNS
      # Enables the _konnected MDNS/zeroconf service advertisement needed for the Konnected App
      - packages/mdns.yaml

      ####
      # STATUS LED
      # Enables the onboard blue status LED as an activity/error indicator
      - packages/status-led.yaml

      ####
      # INPUT ZONES
      - packages/alarm-panel/zone1.yaml
      - packages/alarm-panel/zone2.yaml
      - packages/alarm-panel/zone3.yaml
      - packages/alarm-panel/zone4.yaml
      - packages/alarm-panel/zone5.yaml
      - packages/alarm-panel/zone6.yaml
      - packages/alarm-panel/zone7.yaml
      - packages/alarm-panel/zone8.yaml
      - packages/alarm-panel/zone9.yaml
      - packages/alarm-panel/zone10.yaml
      - packages/alarm-panel/zone11.yaml
      - packages/alarm-panel/zone12.yaml

      ####
      # OUTPUTS
      - packages/alarm-panel/alarm1.yaml
      - packages/alarm-panel/alarm2.yaml

      ####
      # WARNING BEEP
      # Enables a 'Warning Beep' entity, intended to be used with a piezo buzzer or other pulsing.
      # binary output This is implemented using the light component with strobe effect to create a 
      # repeated beeping sound or pulsing action that can be turned on via the _strobe_ effect.
      - packages/warning-beep.yaml
  
dashboard_import:
  package_import_url: github://konnected-io/konnected-esphome/alarm-panel-pro-esp32-ethernet.yaml@master
  import_full_config: false

####
# WEB SEVER
# Enables the built-in web server for viewing the device state, internals and controls via web browser
# on the same local network as the device.
web_server:
  include_internal: true

#### 
# LOGGER
# more: https://esphome.io/components/logger.html
logger:

####
# NATIVE API for HOME ASSISTANT
# Enables the native API for Home Assistant
# more: https://esphome.io/components/api.html
api:

First, post your code using code tags. Then post some esphome logs that show what’s going on when sensors supposed to be triggered.

Not sure why some are working, but your binary sensors are configured a little differently to how they’re defined in the packages (pin mode INPUT vs INPUT_PULLUP and no debounce filter).

Yours:

#8
  - platform: gpio
    id: upstairs_pir2
    name: Upstairs PIR 2
    device_class: motion
    pin:
      number: $zone8
      mode: INPUT
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led

Zone package from GitHub (konnected-esphome/packages/alarm-panel/zone8.yaml at 9488f05e2e1ef00fdc4e5175133e7ab4578290e9 · konnected-io/konnected-esphome · GitHub):

binary_sensor:

  - id: zone8
    name: Zone 8    
    pin:
      number: $zone8
      mode: INPUT_PULLUP
    platform: gpio   
    filters:
      - delayed_on_off: $sensor_debounce_time
    on_state:
      - if:
          condition:
            lambda: return id(blink_on_state);
          then:
            - script.execute: blink_status_led

omfg - you’re spot on. In the zone package on github, Zones 1-8 are INPUT_PULLUP, whereas 9-12 are INPUT.
I looked at one, assumed they are all the same and took that as a template.