Relay with time decay for doorbell help!

OK, this is going to be a little long.

I have a Reolink Doorbell that works fine, but in my basement is an old alarm bell from the 50’s that used to ring with my old doorbell and I would like it to work again.

Anyway, what I have done is connected a relay board to a ESP32-3C board and created an automation that would turn on the relay when the Reolink indicated a visitor (by pushing the button) and turn off the relay when it stops indicating a visitor. The problem is that Reolink doesn’t stop indicating a visitor when you stop pressing the button, it just has a timer for one minute and an alarm bell ringing for one minute is enough to make me want to burn the house down! So what I’m trying to do is make it so that when visitor is indicated the relay will switch on for only 1.5 seconds. This is the code for what I have so far, but everything I do just keeps the relay on continuously.

alias: Basement bell
description: ""
trigger:
  - type: turned_on
    platform: device
    device_id: d4ddd718e3e04b39374d06eb7019a56a
    entity_id: c4b90e93086ee72b176df035a55909cc
    domain: binary_sensor
condition: []
action:
  - type: turn_on
    device_id: 8b659b3aa784ef859612e8c1c1b1a998
    entity_id: 1f71319bf77d2435b4b9e317f659b742
    domain: switch
  - service: timer.start
    metadata: {}
    data:
      duration: 00.01.30
  - type: turn_off
    device_id: 8b659b3aa784ef859612e8c1c1b1a998
    entity_id: 1f71319bf77d2435b4b9e317f659b742
    domain: switch
mode: single

delay, not timer.

- delay:
    seconds: 1.5
1 Like

I finally got it to work, Sorry if I wasted anyone’s time.

Here is the code that worked for me.

alias: Basement bell
description: ""
trigger:
  - type: turned_on
    platform: device
    device_id: d4ddd718e3e04b39374d06eb7019a56a
    entity_id: c4b90e93086ee72b176df035a55909cc
    domain: binary_sensor
condition: []
action:
  - type: turn_on
    device_id: 8b659b3aa784ef859612e8c1c1b1a998
    entity_id: 1f71319bf77d2435b4b9e317f659b742
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - type: turn_off
    device_id: 8b659b3aa784ef859612e8c1c1b1a998
    entity_id: 1f71319bf77d2435b4b9e317f659b742
    domain: switch
mode: single

why not just set the esp to do this?

change the switch in esp code to turn off after some delay. this way you automation can just call the ring every xx seconds while person is at door. This also ensures that if for reason HA and the ESP stopped talking while buzzer going off it will turn OFF vs it going off until it burns itself out


switch:
  - platform: gpio
    pin: GPIO32
    name: "Relay32"
    id: Relay32
    on_turn_on: 
    - delay: 750ms
    - switch.turn_off: Relay32

1 Like