Automation trigger - only after certain number of same events

Hi folks,

I have DIY doorbell by using hue dimmer switch in parallel with my doorbell button to make the doorbell smart to trigger the notification. It kinda works but for some reason there are ghosts events generated and the dimmer switch is saying it is pressed even though it is physically not.

The ghost event trigger only one event so I want to send the notification only for the real button press. Need to figure out why those ghost are happening but in the meantime…

Can someone please help to configure the automation in a way that it is triggering the notification only after 2 or 3 same events are received within one or two seconds?

Events triggered by doorbell press are like that - for some reason two or three are triggered within very short time:

event_type: hue_event
data:
  id: doorbell_button
  device_id: 6023030be9879fcff999a17fb50306d9
  unique_id: db82b70b-bd9e-4889-a1c5-0048788680d8
  type: repeat
  subtype: 2
origin: LOCAL
time_fired: "2023-11-26T17:25:26.416233+00:00"
context:
  id: 01HG6AM98G6JRA0YFSDM9J6JD7
  parent_id: null
  user_id: null

and

event_type: hue_event
data:
  id: doorbell_button
  device_id: 6023030be9879fcff999a17fb50306d9
  unique_id: db82b70b-bd9e-4889-a1c5-0048788680d8
  type: repeat
  subtype: 2
origin: LOCAL
time_fired: "2023-11-26T17:25:25.366649+00:00"
context:
  id: 01HG6AM87PTE8BB75CHZG7WE7D
  parent_id: null
  user_id: null

My automation which is successfully sending the notification to my phone:

alias: Doorbell
description: ""
trigger:
  - platform: event
    event_type: hue_event
    event_data:
      id: doorbell_button
      device_id: 6023030be9879fcff999a17fb50306d9
      unique_id: db82b70b-bd9e-4889-a1c5-0048788680d8
      type: repeat
      subtype: 2
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: notify.mobile_app_jaro_13
    data:
      message: Doorbell pressed...
      title: Doorbell
      data:
        push:
          sound: mixkit-doorbell-double-quick-press-335.wav
mode: single

Thanks for help…

Add a Wait for trigger action with the same event trigger.

alias: Doorbell
description: ""
trigger:
  - platform: event
    event_type: hue_event
    event_data:
      id: doorbell_button
      device_id: 6023030be9879fcff999a17fb50306d9
      unique_id: db82b70b-bd9e-4889-a1c5-0048788680d8
      type: repeat
      subtype: 2
condition: []
action:
  - wait_for_trigger:
      - platform: event
        event_type: hue_event
        event_data:
          id: doorbell_button
          device_id: 6023030be9879fcff999a17fb50306d9
          unique_id: db82b70b-bd9e-4889-a1c5-0048788680d8
          type: repeat
          subtype: 2
    timeout: "00:00:05"
    continue_on_timeout: false
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: notify.mobile_app_jaro_13
    data:
      message: Doorbell pressed...
      title: Doorbell
      data:
        push:
          sound: mixkit-doorbell-double-quick-press-335.wav
mode: single

If you continue to have issues with ghost triggering, you could also add a delay after the notification action to “lockout” the automation for a few seconds.

Thanks for swift reply! Your suggestion configured, I’ll post the result here after some observation.

So, confirmed the solution posted by @Didgeridrew works perfectly. Thanks again…