SmartThings Community

SmartThings Text-To-Speech for Sonos (playText) not working?


(Kris Linquist) #1

It seems that anything that has been “said” by anyone before as its MP3 cached on SmartThings side and still works, but any new phrases do not.


Sonos Weather with DLNA Render
New Official Integration: Samsung Multiroom Audio
[OBSOLETE 1.1.6 5/25/16] Big Talker - Talk when events occur
(Tim Slagle) #2

Is this custom code or one of our apps?


(Kris Linquist) #3

It’s custom code based on one of your apps. I’m sending this to the app:
{“value”:“Hello MyName”,“command”:“playTextAndResume”}

The result I get back in the live logs:
10:03:44 AM: error org.springframework.transaction.HeuristicCompletionException: Heuristic completion: outcome state is rolled back; nested exception is org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only @ line 204
10:03:43 AM: debug Sending playTextAndResume to Sonos Play3

If I send “Good Morning” OR any other common phrases, they’ll work fine - I’m guessing because SmartThings already has them cached in their S3 bucket.


(Tim Slagle) #4

Can you share the code? Either privately or here? I’d love to take a look. I think you might be missing some key pieces.


(Kris Linquist) #5

Thanks Tim - just sent you a PM.


(Tim Slagle) #6

Looking into this. Seems to be a wider issue. I’ll update when I have something :smile:


(The fish is still dead.) #7

Thanks, Tim! I’ve been seeing playText() oddities as well that I didn’t think were there in the past.


(Micheal ) #8

Tim,

This is the same issue you and I discussed this morning…


(Kris Linquist) #9

I fixed it myself by using tts-api.com to generate an MP3 link then just sending playTrack…


(Micheal ) #10

I have never heard of that, but that is kinda neat! I assume you use it like this "playTrack(“http://tts-api.com/tts.mp3?q=text to speak”)? I believe there is a parameter for duration that is required as well…do you account for that? Can you share a code snipit?


(Kris Linquist) #11

No duration required… I’m literally just doing exactly what you describe except I’m adding ‘&return_url=1’ to the tts-api URL. Make sure to url encode what you want to say to avoid bugs with special characters.


(Micheal ) #12

I guess that is the part that confuses me…are you ‘prestaging’ the url into a variable, essentially replacing the textToSpeech API? So instead of:

def text = "this is a test"
def url = textToSpeech(text, true)
playTrack (url.uri)

You would have something like:

def text = "this is a test"
def url = something to convert the tts-api to an uri
playTrack (url.uri)

or are you simple doing the following:

def url = "http://tts-api.com/tts.mp3?q=this+is+a+test&return_url=1"
playTrack (url)

If it is the last one, not sure why you would care to add the &return_url=1 to the end of it as the URL should just place the mp3 (or should…I am not in front of my Sonos to test this).


(Kris Linquist) #13

I’m using this as part of a custom API call, not directly in a smartapp, so it may not matter.


(Micheal ) #14

Ah…cool…thanks! I appreciate it…


(Micheal ) #15

Not to hijack this thread, but is there an easy way within groovy to send a URL like the TTS-API and capture the resulting text that would normally appear in the browser? I guess like a curl command? I looked at the httppost and httpget commands, but it almost appears they are expecting some sort of JSON to be returned. Anyway it is possible to catch the resulting url link with SmartThings?


(The fish is still dead.) #16

@slagle - Is this something that’s going to be fixed soon, or is it a lower priority? I’ve got a project that hinges on playText working, so I don’t want to dump more time into it if there’s no fix in the pipeline.


(Frank) #17

Any idea when this will be fixed


(Ash (www.smart-dots.com) / Ashutosh Jaiswal) #18

I’ve been having issues with sonos as well… As per support some combinations of words dont work… True ! When i use “leak detected” it fails to save page for a water sensor sonos voice notification. But when i write “water detected”, it saves…


(Kris Linquist) #19

Like I mentioned, it seems that phrases they have previously cached work, but new phrases do not.


(The fish is still dead.) #20

@slagle

Any news? Is anyone working on this?