Second MQTT binary sensor looses first

Forgive me if there is something obviously wrong here, I am new to Home Assistant. I added a homemade doorbell to my hassio configuration.yaml using

binary_sensor:
  - platform: mqtt
    state_topic: "doorbellsensor/status"
    name: "Front Door"
    device_class: occupancy
    off_delay: 30

This gave me a binary_sensor.front_door which worked really well. I went on to add a second doorbell and changed to state topic to reflect which doorbell was pressed. My configuration.yaml now looks like this…

binary_sensor:
  - platform: mqtt
    state_topic: "doorbellsensor/status/front"
    unique_id: db1
    name: "Front Door"
    device_class: occupancy
    off_delay: 30
    
binary_sensor:
  - platform: mqtt
    state_topic: "doorbellsensor/status/back"
    unique_id: db2
    name: "Back Door"
    device_class: occupancy
    off_delay: 30

Unfortunately, after rebooting, the binary_sensor.front_door has disappeared but binary_sensor.back_door has appeared.

Reversing the order to the two entries in configuration.yaml brings back the binary_sensor.front_door but the binary_sensor.back_door is marked as unavailable. Is there something I am missing that is need to have two MQTT binary sensors?

Remove the binary_sensor: part at the top of the second sensor and remove the empty lines between. You can only have one binary_sensor: section in a single file.

Thanks very much, that did the trick. Gradually I am learning how to make use of Home Assistant.