Ring to open door if some1 lately arrived

hi there.

i looked up (hopefully) all posts, watched all videos and ask nearly every1 … :smiley:

i cant get my ring intercom to open the door, if a device lately got home and ringd the door.

i want the intercom to open the door, if i get home and ring the doorbell.

i have:
a timer: timer.timer_daniel_ankunft
a button to open: button.eingangstur_tur_offnen
a event: event.eingangstur_klingeln

(sorry for the german words)

i cant get to to work :frowning:

Hello cike ,
Could you possibly show us your YAML so we can get a better idea what is happening?

  1. 3 dots
  2. edit in yaml
  3. copy
  4. paste here How to format code or use the</> key in the post editor.
alias: Eingangstür öffnen – Klingeln nach Daniels Ankunft
description: >
  Öffnet die Eingangstür, wenn innerhalb von fünf Minuten nach Daniels Ankunft
  geklingelt wird.
triggers:
  - trigger: event.received
    target:
      entity_id: event.eingangstur_klingeln
    options:
      event_type:
        - ring
conditions:
  - condition: state
    entity_id: timer.timer_daniel_ankunft
    state: active
actions:
  - action: button.press
    target:
      entity_id: button.eingangstur_tur_offnen
  - action: timer.cancel
    target:
      entity_id: timer.timer_daniel_ankunft
mode: single

should be simple

What does the debug trace show? Which step is failing?

your right. *twice!

but there is no error in the trace

There’s no Wait for Trigger action in the automation you shared…so either you shared the wrong automation or the wrong trace…

Also, please format your configs properly as you were asked to do previously.

I you run the action button.press in the Action tool does it work as expected?

yes. it works like a charm (needed 10 characters)

I’m assuming you have another automation that starts the timer when it detects presence, correct? And then, as part of safety, I assume, you don’t want to directly open the door when presence is detected, but in addition have the doorbell rang, right? If so, all you really need is to trigger on the doorbell button and have a condition to check if the device is home (and if you want to refine that, add a for to the condition with the amount of time you want them to be home, say 10 sec or whatever).

I do something similar, but I use the motion detector of my doorbell instead of the button, and I also check the time of day and whether the alarm is disarmed.

For inspiration:

  - alias: "Open The Gate When Arriving Home"
    initial_state: true
    trigger:
      - platform: state
        entity_id: binary_sensor.pieter_present
        to: "on"
        # prevent false positive due to flaky connectivity or after loadshedding and sensors being unavailable
        not_from: "unavailable"
    mode: single
    condition:
      - condition: and
        conditions:
          # prevent a glitch in case the cover was recently closed
          # since there is also an availability template for the cover defined, it will usually also prevent the gate from opening
          # when the location gets updated after the power returns (after loadshedding)
          - condition: state
            entity_id: cover.main_gate
            state: "closed"
            for:
              minutes: 2
          - condition: time
            after: "07:00:00"
            before: "23:00:00"
    action:
      # what if the presence sensor is slow to update, so we trigger motion before we're detected as home?
      # i don't think it's a good idea to have a motion trigger and then choose between the wait below and one for presence
      # rather use a recency check
      # keep in sync with the garage door template
      - wait_template: >-
          {% set last_motion_detected = (now() - states.binary_sensor.doorbell_motion_detected.last_updated).total_seconds() %}
          {{ is_state('binary_sensor.doorbell_motion_detected', 'on') or
             (is_state('binary_sensor.doorbell_motion_detected', 'off') and last_motion_detected <= 30) }}
        timeout: "00:01:00"
        continue_on_timeout: false
      - wait_template: "{{ is_state('alarm_control_panel.home', 'disarmed') }}"
        timeout: "00:01:00"
        continue_on_timeout: false
      # it was closed, but check that it still is, otherwise we might toggle it
      - condition: state
        entity_id: cover.main_gate
        state: "closed"
      - if:
          - condition: state
            entity_id: binary_sensor.pieter_driving
            state: "on"
        then:
          - service: cover.open_cover
            entity_id: cover.main_gate
        else:
          - service: script.turn_on
            entity_id: script.open_pedestrian_gap

i try´d to simplify it, but still doesnt work.

description: ""
triggers:
  - trigger: event.received
    target:
      entity_id: event.eingangstur_klingeln
    options:
      event_type:
        - ring
conditions:
  - condition: zone.in_zone
    target:
      entity_id: device_tracker.daniel_iphone
    options:
      behavior: any
      for: "00:00:00"
      zone: zone.home
actions:
  - action: button.press
    metadata: {}
    target:
      entity_id: button.eingangstur_tur_offnen
    data: {}
mode: single

or

description: ""
triggers:
  - trigger: state
    entity_id: event.eingangstur_klingeln
conditions:
  - condition: zone.in_zone
    target:
      entity_id: device_tracker.daniel_iphone
    options:
      behavior: any
      for: "00:00:00"
      zone: zone.home
actions:
  - action: button.press
    metadata: {}
    target:
      entity_id: button.eingangstur_tur_offnen
    data: {}
mode: single

im in the zone :smiley: but automation wont fire the button

i guess i found the problem, but no solution.
for some reason the “ringing the bell” isnt recognized.
the door bell rang a “few” times today…

The YAML you shared has the event trigger on

- ring

Could it be a localization issue where it might need to be in German, or perhaps Ring?

If not, you could try and use a state trigger on the doorbell event and trigger on Any (blank). I did that before the new event trigger was added, but I’m not sure how resilient it is.

i switched to english. tryd, switched to german back again, tryd "event type: “klingeln”, back to english again and tryd the aditions trigger.

no solution

description: Door auto
triggers:
  - trigger: event.received
    target:
      entity_id: event.eingangstur_klingeln
    options:
      event_type:
        - ring
  - trigger: state
    entity_id: event.eingangstur_klingeln
conditions:
  - condition: zone.in_zone
    target:
      entity_id: device_tracker.daniel_iphone
    options:
      behavior: any
      for: "00:00:00"
      zone: zone.home
actions:
  - action: button.press
    metadata: {}
    target:
      entity_id: button.eingangstur_tur_offnen
    data: {}
mode: single

Try with this trigger:

triggers:
  - trigger: state
    entity_id:
      - event.portone_ding

And try to reboot HA to see if the event is updated.

Under the dev tools there’s a section (tab) for events. Can you capture the raw event data there for when a button is pressed?

SOLVED

after a few hours of testing, running outside, ringing, get inside again aso …
i got the thingy running but with full-auto on the door opener. it wont stop until i stoped script.
the problem is/was that my ringing isnt recognized some how…

so here my code and how it runs for me
big thx for all the ppl who helped me!

alias: Tür öffnen wenn ich nach Hause komme und klingel
description: v1.4
triggers:
  - trigger: state
    entity_id: event.eingangstur_klingeln
conditions:
  - condition: template
    value_template: "{{ trigger.to_state.attributes.event_type == 'ring' }}"
  - condition: zone
    entity_id: device_tracker.daniel_iphone
    zone: zone.home
actions:
  - target:
      entity_id: script.tur_offnen
    data: {}
    action: script.turn_on
  - delay: "00:00:03"
  - target:
      entity_id: script.tur_offnen
    action: script.turn_off
mode: single