I have a fair few sonos speakers around the house, all connected to OH
I also have a doorbell that is connected through Alexa, (thanks for the idea @rlkoshak), which triggers an item switch ON if press.
The idea is to get certain sonos speakers to play a sound / speak when the doorbell is pressed to alert us.
I have created a rule, which does just this, Blockly code below:
This works surprisingly well, but is just a bit clumsy.
Essentially, I’ve got a gSonosDoorbell group where the speakers I want to use are in. The rule checks to see if the doorbell item, (aArloDoorBellPress), is ON, and if it is it then gets the name of each member of the group in turn and sends them commands:
It plays mp3s from the Doorbell playlist on Sonos, (I did this so I can put whatever I want in there, doorbell, dog barking etc)
It sets the volume
It tells the speaker to play
It repeats the mp3 in the playlist
It sends me a notification
After 25 seconds it stops everything.
This works well and upon triggering the rule the speakers play the doorbell sound, the doorbell then repeats a couple of times more before the 25 second timer ends.
The issue is that they just ride roughshod over anything that is playing at the time, doesn’t return the speaker to the original state and, as the rule take a few (milli) seconds to run through each member, the doorbell isn’t at the same time on all speakers causing a cacophony of doorbells through the house.
It does mean that we won’t miss the doorbell but it will come with a moaning wife, which I don’t want!
I know it’s possible to group speakers within the sonos app, which syncronises the sound played and when I was playing with the same process through the Alexa app it managed to pause what was playing, play the doorbell and then return to what it was previously playing…
I don’t want to get too technical with the rule and find that it takes 5/10 seconds to set up and run as by that time the person ringing will have left but I would really like it to be a more elegant solution as I can see the basis of this rule being useful elsewhere in my system for announcements etc.
So, is there a better way to write the rule or perhaps to grab the existing settings, group the speakers, do the doorbell, and then ungroup them back. OR is there some sort of ‘announcement’ function or channel that I could use to better effect?
Anyone out there managed something similar or have any guidance? TIA