Unifi Doorbell Automation sometimes triggered 4 times

I have the following automation which plays the camera stream from my Unifi doorbell to my Google home. The problem is that it is triggered 4 times lately for unknown reasons. Is there anything i can improve on my automation?

Maybe a condition i can add?

- id: deurbel
  alias: Iemand drukt op de deurbel
  - platform: state
    entity_id: binary_sensor.unifi_g4_deurbel_doorbell
    from: 'off'
    to: 'on'
  condition: []
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: camera.play_stream
      entity_id: camera.unifi_g4_deurbel_high
      media_player: media_player.tv_meubel
      format: hls
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - service: media_player.turn_off
    entity_id: media_player.tv_meubel

If the doorbell sensor actually is going from ‘off’ to ‘on’ when it isn’t supposed to then there’s not much you can do.

the only thing you can do is add a condition that the automation hasn’t triggered in the time it takes for the sensor to stabilize.

  - condition: template
    value_template: "{{ now() - state_attr('automation.iemand_drukt_op_de_deurbel', 'last_triggered') > timedelta(minutes=1) }}"
1 Like

Excellent suggestion, i will implement this immediately!

Unfortunately that didn’t work. It was just triggered 6 times for 1 doorbell press