It’s hard to optimize it more, since it’s just script commands in a sequence.
You might be able to move the volume_set command up before the delay without it affecting anything, but you will have to test it.
Besides that you can not in the script optimize more as such.
You can play a bit with the Ringklokke01 sound, like loading it into a sound editor, like Audacity and see if there is some silence in the start that can be removed and you might also be able to gain a few milliseconds by using a wave instead of a mp3, but again you need to test this to be sure.
I bet that it’s all on the sonos end and you can’t do much to improve it. Try triggering the automation manually by clicking the “run actions” button on your automations page to make sure that it’s not the shelly.
Other ideas:
Use a carefully placed motion sensor to trigger the doorbell instead of someone pressing it to get a head start
Get an off-the-shelf buzzer that integrates into home asssistant
make your own smart buzzer using esphome
if you are not usually playing music while your doorbell rings, ditch the snapshoting and see how quick the sonos is. Just live with the interruption.
Thank you both @Dolores and @WallyR for your contribution! Really appreciate it!
I managed to get the responstime down by removing the delay and moving most of it to “Scripts”.
Furthermore, I added “unjoin” (best practice) but not sure that contributed to a speedier process
Really!!! I am shocked that it improved it much but I am not a software developer. If you had just offloaded the snapshot I would be less surprised. How fast would you guess that it is now? Thank you for following up. You should flag your post as the solution.
Actually, @Dolores, I’m shocked too!
I also added the “unjoin” but not sure that helped speeding the process, though!
I accidently managed to short-circuit the battery before I could check the actual improvement in seconds (mother in-law pushed the button SO hard it got stuck, resulting in me disassembling the thing and unfortunately the wires popped out of the socket and touched!
Hi @Dolores and @WallyR - you are absolutely right, better open that door straight away next time
I finally got a new button and everything works flawlessly now! With music already playing on the Sonos speakers that are used for playing the Ding Dong ringtone, it now takes only 1 sec from the button push to Sonos actually playing the mp3.
Once again, thanks for your contribution! Really appreciate it!