But how is it possible to know when the announcement has finished?
None of the media players attributes appear to get updated with the announcement details (e.g. media_duration)
Which makes sense as some kind of black magic is going on presumably the Sonos api is being used to get the announcement to play over the current music.
So knowing when it has finished seems like it might be impossible?
I couldn’t determine when the announcement ended, so I calculated a delay based on the message length and words per minute. I used a paragraph with a specific word count and timed my speaker to get its duration.
This is part of my script for notifying and/or speaking through speakers. The delay allows me to repeat messages. It also helps automate other tasks, such as waiting for the message to be spoken before starting music or opening blinds, so the sound doesn’t distract me.