Open jzee opened 3 years ago
I have the same issue with the Google key failure. I'm not able to get the playClip to work either, but I have a feeling that I'm just not doing that part right.
Same here as well, just installed from scratch and am getting the same message. /api/playClip doesn't work either, but this time I get success false and missing parameters. Edit: Hey @patchrick84 and @jzee after a bit of looking around, I've found that some of the forks have been updated. If you want just a doorbell sound, and no speech, you want this one as I get the same error if I try to send text to it from @Letrab. https://github.com/Letrab/hassio-addons This one seems to work with text, but no doorbell chime from @jeffothy. https://github.com/jeffothy/hassio-addons Hopefully @kevinvincent will be able to see what's changed from here and update the main addon.
I am willing to merge the changes from @jeffothy to my fork if that helps?
The better option would be to replace the Google tts altogether in the end: https://github.com/kevinvincent/hassio-addons/issues/6
@Letrab That'd work I think. Definitely switching over to google cloud would be great as well.
I appreciate the work you guys are putting into this. As a non-developer I'd be stranded in the water without your help. Looking forward to your merges and changes!
Updated my fork just now. Untested though atm...
Upgraded all packages to be future-proof. So as well the oauth module for example, so could be that authentication is broken. If so, let me know!
I hope this isn't too noob of me, but bear with me. How do I add Letrab's fork to Home Assistant? If I go to your page and copy your link to add to the repositories in HA, it still links here to Kevin's.
@patchrick84 : Try again now, changed all URL to reference to my fork, which is needed apparently. Let me know if it works (as I don't use hassio myself, I use this module standalone).
Alright, now I'm getting "success: false" when I do the "allclipcapabledevices" step. I redid the entire thing from scratch, even regenerated my API key on the Sonos site, but still no go.
Edit: After restarting the add-on it produced more info. Here's the log:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done.
sonos-audioclip-tts@1.0.0 server /app node server | pino-colada Starting with configuration: { SONOS_CLIENT_ID: '(deleted)', SONOS_CLIENT_SECRET: '(deleted)', GOOGLE_TTS_LANGUAGE: 'en-US', LOCAL_URL: 'hassio.local', PORT: 8349 } Express server is running on http://hassio.local:8349 Access Token Error Response Error: 400 Bad Request Access Token Error Response Error: 400 Bad Request TypeError: Cannot read property 'households' of undefined at /app/server/index.js:220:14 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:207) UnhandledPromiseRejectionWarning: ReferenceError: hhResultText is not defined at /app/server/index.js:230:58 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:207) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:207) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 16:11:28 ✨ request completed GET 200 /api/allClipCapableDevices 159ms
Should have tested it first. Made an error porting to the new oAuth library... Fixed now! Sorry for the inconvenience @patchrick84 !
@Letrab - it's working now! At least, through the URL bar in my browser. Now I just have to teach myself how to integrate it into Home Assistant. I'm still a noob on that front!
Thanks!
@Letrab - it's working now! At least, through the URL bar in my browser. Now I just have to teach myself how to integrate it into Home Assistant. I'm still a noob on that front!
Thanks!
As said, I am not an hassio user myself. But as @kevinvincent stated in his documentation, you can use a rest command from hassio: https://www.home-assistant.io/integrations/rest_command/ . Just paste your wanted URL there ;-).
If you need parameters in the URL, you can follow this guide: https://community.home-assistant.io/t/execute-rest-command-with-variable-url-etc/53913/3
eg:
rest_command:
speak_text:
url: "https://hassio.local/api/speakText?text={{ text }}&playerId={{ playerId }}"
script:
test_speakText_cmd:
sequence:
service: rest_command.speak_text
data:
text: "Good morning Vietnam!"
playerId: "RINCON_01234567890123456"
(again, untested, but should be quite it :-))
Could be that you have to change http
to https
or add verify_ssl: false
to get it working properly.
Yup! Through several Google searches and other reading, that's almost exactly what I came up with as well and actually got a test set up working yesterday afternoon. Thanks again for your help and work on this! Hopefully it stays working for a long time.
Hi @Letrab ,
I tried using your fork to fix the key issue, but it seems that the new API change has caused the language param to not work. The old API was const url = await googleTTS('Hello World', 'en', 1);
and the new one expects the second param to be a config object instead of the language. Your fork still uses the old params on line 255 (https://github.com/Letrab/hassio-addons/blob/f482c000eb450e6b79c98f0073be94691f8126d8/sonos-audioclip-tts/server/index.js#L255)
Shouldn't this be changed to the following?
speechUrl = googleTTS.getAudioUrl(
text,
{
lang: config.GOOGLE_TTS_LANGUAGE,
slow: false
}
);
Hey everyone, I've merged in @jeffothy pull request which I believe should fix this based on a quick read of the comments. If not, please let me know and I'll make any further fixes! Sorry for not responding to this as I've been fairly busy with other projects.
Also ideally you can move to calling HASS's TTS to get a media file URL and then send that to playClip. This can be accomplished using this method: https://www.home-assistant.io/integrations/tts/#post-apitts_get_url and then calling playClip with the returned URL. The benefit of this method is that you can use any TTS service that integrates with HASS already.
Hi @Letrab ,
I tried using your fork to fix the key issue, but it seems that the new API change has caused the language param to not work. The old API was
const url = await googleTTS('Hello World', 'en', 1);
and the new one expects the second param to be a config object instead of the language. Your fork still uses the old params on line 255 (https://github.com/Letrab/hassio-addons/blob/f482c000eb450e6b79c98f0073be94691f8126d8/sonos-audioclip-tts/server/index.js#L255)Shouldn't this be changed to the following?
speechUrl = googleTTS.getAudioUrl( text, { lang: config.GOOGLE_TTS_LANGUAGE, slow: false } );
Correct! Fixed
Just installed the add-on from scratch, succeeded authenticating and creating an API key, configuring the plug-in with the client keys and secret
I'm running on hass.io 0.118.5
As an initial test, I tried to call http://hassio.local:8349/api/speakText?playerId=RINCON_XXXXXXXXXXXXXXXXX&text=hello&volume=20
There was nothing audible on my system, instead I received the following error
{"success":false,"error":"Error: get key failed from google\n at /app/node_modules/google-tts-api/lib/key.js:30:32\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at async /app/server/index.js:319:17"}
What am I doing wrong?
EDIT: api/playClip works fine and the audio plays alright!
The plug-in log shows
My system configuration is as follows: