Hello everyone,
I want to share my solution for using a Ring Intercom integration as a lock. The integration only supports the button to open the door, which works, but the entity is not usable, for example, in a Mushroom lock card. The state of the button only shows when it has been pressed. I searched for a solution but couldn’t find a good one.
Lock Template: (replace your button in the lock template card)
# Ring Intercom Lock Template
lock:
- platform: template
name: "Haustür"
value_template: >
{% set last_pressed = states.button.haustur_tur_offnen.last_changed %}
{% if last_pressed and (now() | as_timestamp - last_pressed | as_timestamp) <= 1 %}
false
{% else %}
true
{% endif %}
lock:
service: script.no_op # Platzhalter, da keine Sperrfunktion benötigt wird
unlock:
service: button.press
target:
entity_id: button.haustur_tur_offnen
I noticed that Home Assistant is relatively slow in detecting a change in entities, so I had to create an automation that triggers after pressing the Ring Intercom button to check the status of the entity. I added a 2-second delay, which I believe is sufficient, but it can be adjusted if needed.
alias: Haustür Status aktualisieren
description: ""
triggers:
- trigger: state
entity_id:
- button.haustur_tur_offnen
conditions: []
actions:
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- action: homeassistant.update_entity
data:
entity_id:
- lock.haustur
mode: single
With this automation, the door opens when the doorbell is pressed.
alias: Haustür öffnen wenn Klingel betätigt wird
description: Auslösen, wenn die Haustürklingel betätigt wird
triggers:
- trigger: state
entity_id:
- event.haustur_klingeln
conditions: []
actions:
- action: lock.unlock
metadata: {}
data: {}
target:
entity_id: lock.haustur
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
mode: single
And the last automation is designed so that when I enter my home zone and ring the doorbell within a certain period of time, the door opens.
alias: Haustür öffnen Ein- und Ausschalten wenn Home zone betreten oder verlassen
description: ""
mode: restart
triggers:
- entity_id: person.xxx
zone: zone.home
event: enter
trigger: zone
- entity_id: person.xxx
zone: zone.home
event: leave
trigger: zone
conditions: []
actions:
- choose:
- conditions:
- condition: zone
entity_id: person.xxx
zone: zone.home
sequence:
- data: {}
target:
entity_id: automation.haustur_offnen_wenn_klingel_betatigt
action: automation.turn_on
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- data: {}
target:
entity_id: automation.haustur_offnen_wenn_klingel_betatigt
action: automation.turn_off
default:
- data: {}
target:
entity_id: automation.haustur_offnen_wenn_klingel_betatigt
action: automation.turn_off
If anyone has suggestions for improvement, I would be very happy to receive feedback.