Amazing! Bravo Sir! You have just given everyone the ability here to use devices that many of us commonly own to get Text To Speech notifications or alarms all around our house, without buying expensive Sonos speakers!
For some who dont know: DLNA is the protocol that many of already have in our Android cell phones, Android Tablets, SmartTVs, Media Players, Blu-Ray, Xbox and Playstation game consoles, Raspberry Pi or Amazon Fire TV with XBMC or Kodi, Talking of millions already have DLNA. I believe the new Pure Jongo devices people were talking about on have it too. I wonder what other more affordable network speakers will work out of the box with this? Yeah thats right, its Saturday night and new code came out lol!
EDIT: So Media Render is a type of DLNA speak, so NOT all devices have it. Good example listing would be http://en.wikipedia.org/wiki/List_of_UPnP_AV_media_servers_and_clients#UPnP_media_render_hardware Obviously this list is just an example
I have already tested your code and it worked wonderfully for my XBMC and Kodi installations with just UPnP turned on. With my Amazon Fire TV with Kodi sideloaded, your fiber optic cable still transmits even when your TV is off! So i routed a fiber optic cable to a cheap speaker bar, which is always powered on from the wall, and my TV near the main doorway has just become a 24/7 notification or announcement system! My main TV with surround system also worked too, using fiber optic to 7.1 surround.
As for Airplay, it is not compatible with DNLA. However some devices have both protocols now a days, so maybe only newer devices or high end speakers would be applicable. Right off the bat I would recommend a $29 device that converts any old speakers to DNLA and also Airplay, because I just ordered one after verifying this code works http://www.amazon.com/Sabrent-Receiver-Supports-Portable-WF-RADU/dp/B00L26YDA4/ref=sr_1_3?ie=UTF8&qid=1423955744&sr=8-3&keywords=dlna+speaker
Concerns: After one announcement, I used the audio controls within the SmartThings My App and it started playing your favorite spanish radio station, and it was not clear how to easily change or browse to a different playlist. If it was at least Music it would have been entertaining, but sadly, it was only some news haha.
I also noticed a bit of lag when a playing video goes to pause and the text to speech kicks off, and I miss my custom message if my device is not fast enough to switch, so I am looking into adding some delay or spacing before the speech starts. I wonder if with DLNA, you can check to see if a DLNA Client is idle before re-directing it to play a particular steam or is it just a forced broadcast? Also instead of a custom message, can we use a locally stored mp3 to speed up the process? I am sure I can look into it.
Anyhow just wanted to thank you once again for how wonderful the code and instructions were on github, we appreciate all the time and effort!