I’ve setup the following automation and it only occasionally works. If I check the logbook it rarely indicates that the bell had been pressed. UniFi protect correctly shows bell pressed x mins ago…
Any ideas? It’s driving me bonkers…
alias: Doorbell Pressed
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_doorbell
to: "on"
from: "off"
condition: []
action:
- service: notify.alexa_media
data:
target:
- media_player.studyecho
- media_player.bootroomecho
- media_player.kitchenecho
- media_player.loungeecho
message: >
'"{{ ("<audio
src='https://xxx.ui.nabu.casa/local/sounds/chime.mp3'/>",
)|random }}"'
data:
type: tts
- service: notify.lounge_tv
data:
data: {}
message: Doorbell pressed
mode: single
I’m using almost the same automation for my G4 (not pro) doorbells.
My triggers are slight different then yours, these are mine:
alias: "Security: Doorbell pressed"
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.frontdoor_doorbell
to: "on"
- platform: state
entity_id:
- binary_sensor.backdoor_doorbell
to: "on"
As you can see I only specify a TO state and ignore the FROM state.
Did you test the service call to alexa, does it work? I dont own an Alexa device so I can not tell you how that should work. My automation triggers all sonos media players in the house.
Credits goes out to John Zanussi: Playing UniFi G4 Doorbell Chime through Sonos with Home Assistant
1 Like
Thanks for sharing your code. I think that the problem is that I’m not always seeing the event in the logbook, so it’s not registering to trigger the automation. I’ve also set the user account it uses to full admin, which works once
I think it’s something to do with the integration, but I’m not sure…
Thanks I wasn’t aware. It’s also not showing in history.