Sonos + Home Assistant + Unifi doorbell
Bug free Sonos + Home Assistant and Unifi doorbell "rings" on your Sonos system

Early in my Home Assistant journey, I ran across https://labzilla.io/blog/homeassistant-door-chime - which I quickly adapted for my own needs. I already had a decent set of Sonos speakers and had just invested in the Unifi video doorbell.
When the doorbell rings, HA snapshots the current state of all the speakers, bumps up the volume a bit, plays a doorbell chime, and then restores everything back to where it was on the Sonos speakers. Quite a cool little trick if you ask me.
Only one teeny problem - every time my UDM Pro updated, the doorbell would ring. That was annoying, especially at 3am, the default update time. It has low PAF (Partner Acceptance Factor) too.
One afternoon, not too long ago, I was chatting with a fellow HA enthusiast friend, and he had a simple suggestion that might fix that bug. Turns out he was dead on!
Here is what he shared with me:
Or change the trigger to only trigger when it goes from off to on, and not simply to on.
I chose the latter, and now I can set the update time back to the default 3am without being worried about a false positive door bell ring.
Thanks friend <3
Here's the YAML to adapt for your needs, enjoy!
alias: Play chime on Sonos when doorbell is pressed
description: "When the doorbell is run, save state of Sonos systems, bump the volume up, play a chime, then restore Sonos to the previous state"
triggers:
- entity_id: binary_sensor.front_doorbell_doorbell
from: "off"
to: "on"
trigger: state
conditions: []
actions:
- data:
entity_id: all
action: sonos.snapshot
- target:
device_id:
- <sonos-device-id-speaker-1>
- <sonos-device-id-speaker-2>
- <sonos-device-id-speaker-3>
- <sonos-device-id-speaker-4>
data:
volume_level: 0.65
action: media_player.volume_set
- target:
device_id:
- <sonos-device-id-speaker-1>
- <sonos-device-id-speaker-2>
- <sonos-device-id-speaker-3>
- <sonos-device-id-speaker-4>
data:
media_content_type: music
media_content_id: http://homeassistant.example.com:8123/local/sounds_sounds_ring_button_Chime.mp3
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- data:
entity_id: all
action: sonos.restore
mode: single
The updated version
In case you are curious, here is the OLD version, prior to my friends suggested fix:
alias: Play chime on Sonos when doorbell is pressed
description: "When the doorbell is run, save state of Sonos systems, bump the volume up, play a chime, then restore Sonos to the previous state"
mode: single
triggers:
- entity_id:
- binary_sensor.front_doorbell_doorbell
to: "on"
trigger: state
conditions: []
actions:
- data:
entity_id: all
action: sonos.snapshot
- data:
volume_level: 0.65
target:
device_id:
- <sonos-device-id-speaker-1>
- <sonos-device-id-speaker-2>
- <sonos-device-id-speaker-3>
- <sonos-device-id-speaker-4>
action: media_player.volume_set
- data:
media_content_type: music
media_content_id: http://homeassistant.example.com:8123/local/sounds_sounds_ring_button_Chime.mp3
target:
device_id:
- <sonos-device-id-speaker-1>
- <sonos-device-id-speaker-2>
- <sonos-device-id-speaker-3>
- <sonos-device-id-speaker-4>
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 4
milliseconds: 0
- data:
entity_id: all
with_group: true
action: sonos.restore
The version prior to the fix
Note: added some additional context about the specifics of the updates