I have made a script to play a doorbell chime on my Sonos speaker in the kitchen - I call sonos.snapshot and sonos.restore to pause and resume any music already playing (I got the inspiration from Playing UniFi G4 Doorbell Chime through Sonos with Home Assistant - John Zanussi).
A few times I have experienced that the sonos speaker stays silent if it hansn’t been playing anything for a long time - for example overnight. If I then play some music from the sonos app everything works again.
Any ideas?
Scipt below:
alias: Ringeklokke Sonos
sequence:
- service: sonos.snapshot
data:
entity_id: all
- service: media_player.volume_set
target:
entity_id:
- media_player.kokken
data:
volume_level: 0.66
- service: media_player.play_media
data:
media_content_id: /local/Unifi-Chime.mp3
media_content_type: music
target:
entity_id: media_player.kokken
- delay:
hours: 0
minutes: 0
seconds: 4
milliseconds: 0
- service: sonos.restore
data:
entity_id: all
mode: single
icon: mdi:doorbell