Sonos Plugin Request: Alert function without duration value

A Sonos Plugin Request:
Allow the use of the Alert function without specifying a duration value. The function would initiate the playback then monitor for a state transition from playing to non playing, at that point stop the playback.

Scenario:
I use the Alert function so that I can send temporarily alerts directly to my Sonos units or groups. I do this to playback text messages or MP3s without having to go through the TTS API. The URL I send talks directly to my home network’s TTS server or file server for MP3 playback. But I need to have the Alert function stop when the content stops. If I specify too short or too long a duration the content is either cut off or loops until the duration value is hit.
Because TTS is dynamically generated I don’t know the duration value. Guessing is problematic and rarely is accurate.

Prototype:
I hacked up my copy of the Sonos plugin so that I can use the Alert function without having to specify a duration value. I subscribe to the UPnP content transition variable change and use it to determine when the content has ended. At that point I terminate the Alert playback.
It works but I have odd artifacts (sometimes the audio will loop until I manually stop it, not all units I specify as a group playback, etc). I have not thoroughly examined the entire Sonos codebase so I am sure I am doing something wrong.

Having the author have a look into this would be fantastic. :slight_smile: