Template didn't stop loooads of notifications arriving

I have this automation which has a condition which has worked reliably at preventing multiple fires of the same automation within a short space of time. Today, I got 16 messages from this automation within the same second. Does anyone know what could cause this? Has something changed in the code?

Thanks

  - alias: emptyhousedoorbell
    trigger: 
      platform: state
      entity_id: binary_sensor.front_doorbell
      to: "on"
    condition:
    - condition: state
      entity_id: binary_sensor.parents_home
      state: 'off'
    - condition: template
      value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.emptyhousedoorbell.attributes.last_triggered | default(0)) | int > 300)}}'      
    action: 
    - service: notify.steve_iphone
      data:
        message: "Doorbell"
        title: "Doorbell rung, but nobody appears to be home!"
        data:
          url: "https://www.home-assistant.io/"
          sound: pianobar
          priority: 0

Possibly this, though you don’t have as many actions:

You might also be able to do something at the sensor. How are you detecting the doorbell press?

Detecting doorbell presses with a zigbee Xiaomi button. That automation is also sort of ‘protected’ by the same kind of logic. But because the Zigbee sensor directly feeds the binary sensor, I’m not aware of a way (template sensor?) to slow down a floating input…

  - alias: Doorbell_Conversion
    trigger:
      platform: state
      entity_id: binary_sensor.front_doorbell
      to: 'on'
      from: 'off'
    condition:
    - condition: template
      value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.doorbell_conversion.attributes.last_triggered | default(0)) | int > 10)}}'
    action:
      - service: mqtt.publish
        data_template:
          topic: "h-ass/home"
          retain: false
          payload: 'BELL'

I guess I could chalk this one down as a weird bug? The only thing making me reluctant to conclude that is I recently had a new pair of automations, both trying to detect the same event, but in different ways, and automation a) had a condition saying only trigger if automation b) not recently fired, and automation b) had the same thing but for automation a). I found these conditions were not working! I had to move over to an input boolean which I flicked over from on to off and used that as a condition instead to prevent both automations firing at the same time. That worked. Weird.