The Vera Community forums have moved!

Advanced => Plugins & Plugin Development => Programming => Sonos Plugin => Topic started by: jvan on July 17, 2018, 10:41:21 pm

Title: Sonos TTS Fail with all Engines
Post by: jvan on July 17, 2018, 10:41:21 pm
I had the 'SayTheWeather' working for years (TTS was always very good) and recently removed the Sonos App and reinstalled it.
Now, 'SayTheWeather' does not work.
Out of despriation, I installed 'ResponsiveVoice' but that also does not work when I use the TTS feature within a Sonos device.  I also used some of the Luup files on the forum to enable ResponsiveVoice.  It is an option, but it rarely works. When it does, the voice quality is pretty bad.
If I test code in the Apps > Develop apps > Test Luup Code (Lua) it also does not work with the following code:
Code: [Select]
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say",
                          {Text="Hello World", Language="en-GB",GroupZones="ALL", Volume=35, SameVolumeForAll="true"},
Even more simple:
Code: [Select]
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say",
                          {Text="Hello World"},
I also have Sonos device ID's for 115, 116, 117, 118, 119, 120, 121, 122 and replacing the above code with the respective ID always yeilds a 'Code Successfully Sent' message but nothing in the form of audio.
Sometimes it does work, but if it does work on that day at that time, it will not respond again.  I have not tested the previous statement enough to state it as a hard fact, but it's the current observation.

When I play around with the TTS tab on the Sonos device, rarely yeilds audio, although it did work for a brief stint a few days ago but I can't replicate the scenerio.
Changing between 'ResponsiveVoice', 'OsxTTS'... ect... different grouping zones... nothing.
Sometimes I see the "Say\.[0-9]{1,3}\.mp3" in my Sonos Desktop App, but if it played something, I didn't catch it.  Nothing is muted, all online with proper volume.

I often see in the devices that a certain Sonos speaker is "Driven by XYZ" speaker.  This is fine, but if I target the controlling speaker, it changes (in my Sonos Desktop App) to the current track is "Say.123.mp3" but is in the stopped state. Does the "Say" command not imply the speaker to play the text?  Is another command necessary?

Otherwise, the Sonos plugin works well.  I have a Wallmate Quad that can toggle Sonos on/off, change the tracks, increase the volume, decrease the volume, and seek through favorite radio stations.  The Vera player controls also work as expected.  Just the TTS that is a problem.
Any thoughts?
Title: Sonos TTS Fail with all Engines
Post by: PrincessCleavage on July 17, 2018, 11:41:13 pm
Hi jvan,

There is another thread in the Sonos app section ?responsive voice? or something similar where John has provided a fix for responsive voice (he attached some modified files about 4weeks ago)
And my tts is working in general. I have notice a couple of times recently that I had to go into the Sonos app and reload engine (advanced/new service/reload engine) then tts would work again.
The below tts works for me:
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say",
                 {Text="The Washing cycle has completed", Language="en", Volume=75},
luup.sleep (4000)
luup.call_action('urn:upnp-org:serviceId:RenderingControl', 'SetVolume', {DesiredVolume = 50}, 176)

Change 176 to your Sonos app id and you can also remove from luup.sleep onwards as this is just to return volume to 50% after finishing tts.
I hope this is of some help.
Title: Re: Sonos TTS Fail with all Engines
Post by: jvan on July 18, 2018, 12:04:08 am
Thanks Princess,
When I run that Luup command in the TTS interface on the Sonos device it does not work. Nothing in the logs either. I have no idea way. Using Chrome with Vera Edge and the latest firmware.

However, I discovered that when I run the same Luup code in a SCENE, it does work. 
The following works within a scene Luup code:
Code: [Select]
local sMessage = luup.variable_get("urn:joeyd-com:serviceId:SayTheWeather1", "CompleteWeatherStatement", 31)
sMessage = "Good morning. Here's a look at today's weather." .. sMessage
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say",
                          {Text=sMessage, Language="en-GB",GroupZones="ALL", Volume=35, SameVolumeForAll="true"},
Same code in Devices > Sonos Speaker > TTS does not output anything.
The TTS Engine was better before (not sure what I was using, is it possible it was Google and worked up until I removed the Sonos App?). It would be nice to test the different engines.  Is there a way to get/set the current engine with Luup since the TTS tab on audio devices isn't working?
Title: Re: Sonos TTS Fail with all Engines
Post by: PrincessCleavage on July 18, 2018, 03:36:46 am
Running anything in the Sonos app has never worked for my I usually test luup in apps/develop apps area. As for other engines, google is limited and not reliable ms no longer works host your own is an option I guess but responsive voice seem reliable to me