Sonos Say

Which repo did you use?
Ludvig’s?

did you do npm install (to update npm packages)?

yes i took GitHub - ludvigaldrin/com.svipler.athom.sonos-say: Sonos Say Athom Homey App it seems to have your PR in there.

npm install did fix the error. the app is running, The text to speech card works but only on shorter messages. This joke does not work… Other trial: the send url as announcement does not give any sound when i try to play the mp3 from the google services app.

How is your trigger flow?
It should be like:
Trigger flow | Homey

And the start speech flow should look like:
Start Speech flow| Homey

Sonos Say - Say card uses the old Google TTS engine with “bad” voice and max 200 characters.

Ah i see 200 chars. Yes i have the TTS flows setup just like the samples. still no sound, just like the play audio clip card of athom. the generated mp3 is checked it is playing from the browser. How can i see the logs and warnings that are emitted in the code?, or even better can i run/debug the code locally using visual studio code? i have tried npm run, that does not start the app.


{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
“version”: “0.2.0”,
“configurations”: [
{
“type”: “node”,
“request”: “attach”,
“restart”: true,
“name”: “Attach to Homey”,
“address”: “192.168.1.111”, ← change your IP address
“port”: 9222,
“localRoot”: “${workspaceFolder}”,
“remoteRoot”: “/”
} ]
}

Then you can debug.

Or disable/comment the “if (process.env.DEBUG === ‘1’) require(‘inspector’).open(9222, ‘0.0.0.0’, true);” from app.js OnOAuth2Init.

If you save an URL to a variable and play it in the browser? Does it play?

Wonderfull learning a lot here! i got the error in the log:
2021-03-17T21:35:10.147Z INFO Could not find file /node-sonos-http-api-master/settings.json
2021-03-17T21:35:11.237Z INFO Presets loaded: {}

url
/node-sonos-http-api-master/lib/actions/sayurl.js:31
http://192.168.1.116:47333/tts/ca7b8334-1fc9-4a04-bb70-87bd5f9edd54.mp3
/node-sonos-http-api-master/lib/actions/sayurl.js:32
Think its no coordinator
/node-sonos-http-api-master/lib/helpers/single-player-announcement.js:44
isRadioOrLineIn uri: x-sonos-htastream:RINCON_949F3EC2767B01400:spdif
/node-sonos-http-api-master/lib/helpers/is-radio-or-line-in.js:4
2021-03-17T21:36:06.363Z ERROR
/node_modules/sonos-discovery/lib/helpers/logger.js:31
Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control
at Object.invoke (/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)
at Player.setAVTransport (/node_modules/sonos-discovery/lib/models/Player.js:727:15)
at /node_modules/sonos-discovery/lib/prototypes/SonosSystem/applyPreset.js:128:46
at processTicksAndRejections (internal/process/task_queues.js:97:5)

i have dug deeper, i intercepted <s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/” s:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/”><s:Body><s:Fault>s:ClientUPnPError714</s:Fault></s:Body></s:Envelope>’

and that errorcode shows up as invalid mimet ype if i google it.

What kind of (Sonos) device do you have?

And you got the Debugging working?
Could you set some loging at node_modules\sonos-discovery\lib\modesl\Playes.js line 721 (first line of Player.prototype.setAVTransport)
Could you message me the URL and Metadata arguments BEFORE and AFTER xmlEntities.encode(***?

So, at line nummer 727, insert these lines before the return
console.log(uri);
console.log(metadata);
console.log(entityEncodedMetadata);
console.log(entityEncodedUri);

I went and installed version 3.1.5 with the buildIn http-api package of sonos. I was using 2.0.1 previously with my own docker installation of the http-api.

Now it cannot find any speakers, any thought what this could be? Because my docker image does find it. And there is no option to change the ‘api’ server. Would rather keep using my own docker.

Would be great if there is a way to resolve this.

Please check if the app is really running. Try a restart.

After that, you can verify that the node-sonos-http-api-master server is running correctly on homey by typing the URL in a browser:

http://your.homey.IP:5005/sayall/Test/de/60

It seems that’s hard coded in:

Quick hack: You could customize it and use your NAS IP, but in that case you would need to do a CLI install. Until Arie added an option for customizing the IP.

Tnx, should have added a message here. I moved all my Sonos Say flows to the Google Services. Other stuff I was using the Sonos Say app for I migrated to the API command, works great now. Thanks a lot for your effort.

To answer your question, I restarted both homey and the app multiple times, it kept spitting out errors in regards to not finding my speakers. I guess it’s my network which is acting up. No worries, I’m happy with the current way it’s working.

i now got stuck on {“status”:“error”,“error”:“No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn’t resolve itself in a few seconds.”}
Below is see Martijn having the same problem… i have removed all sonos apps and devices, reinstalled the apps, rebooted… no luck

That indeed sounds like the same issues I was facing. I havent been able to resolve it, I worked around it. I’m sorry to say I don’t use the app anymore. I’m now using direct API commands to the HTTP api running on my own docker host.

For me I thought it had to do with my network configuration. Don’t exactly know what setting.

okay, gave up on getting sonos say to work. TTS google services does render a fine mp3. it plays from a browser and it plays if i hardcode the url in sonos play audioclip… but it does not play if i use the [Url] tag, so something is lost during encode/decode of the tag. Maybe a space is added in front of the url? can i maybe call that sonos play audioclip card from homeyscript?
OR can i have tts google service give a hardcoded name for the mp3 it will create so i can hardcode that url in the play audioclip card? Maybe i can rename the mp3 using homeyscript?

, the hardcoded url works for both the beam or the ikea player, the device type is not an issue. the only difference is using the url tag or the hardcoded url.
Okay put the pedal to the metal!. found out how to call the flow card and it now plays!

Hey Jeroen,

I just tested Sonos Say (because i had been having issues as well yesterday).
But, after reinstall it worked fine.

But, since appareantly the Athom Sonos App also (now) restores grouping after Play file, i will be swithing back to the Athom Sonos App.

The Issue of hardcoded URL versus Token-URL has been reported before. Unfortuantly, i cannot do anything about that, i have no control on how the URL/token is passed, this is all basic Homey.
There have been URL-parsing issues with other languages in Homey before, but it was suppose to be solved.

I would advice you to write to support@athom.com so they can solve the issue.

It is not anything anyone beside Athom can do anything about.

Hi @Ludvig, @Arie_J_Godschalk, will Sonos Say be updated to SDK3?

Not by me.
That would be a lott of work, and i am not sure what would be the benefit.

Not highest priority sadly.

Well, for people like me who have a lot of Sonos S1 only devices (no S2) which results in the absense of the “Play an Audio Clip URL” card in the Athom sonos app. Furthermore I would like to use the old google TTS because of the easier configuration. So for me these two points are the benefit. I could use the node-sonos-http-api in docker on my nas alternatively but this would be another component.

But maybe I am one of the few who use and love the app.

Hi @Arie_J_Godschalk ,

may I ask you another request about the sonos say functionality?

I have looked at the code. Sayurl is a really nice addition. The main problem is that only your sonos http api server of the sonos say app has the sayurl action. The original server from GitHub - jishi/node-sonos-http-api: An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar. is missing the sayurl action. If the sonos say app will not transferred to SDK3 this option will be lost.

Could you please send a pull request with the sayurl action to GitHub - jishi/node-sonos-http-api: An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.. So that jishi will hopefully integrate it in his version?

THX Jörg