Hypnos3/node-red-contrib-cast

Error in TTS

Closed this issue ยท 41 comments

When I try the example using txt to google home device, I get the following error.

Not able to get media file via google-tts:get token key failed from google

And this is in my node red log.
30 Nov 21:48:18 - [error] [cast-to-client:8d9663a.05e27a] Not able to get media file via google-tts:get token key failed from google

I am using this example.
https://flows.nodered.org/node/node-red-contrib-cast
sends an text to Google TTS

Same issue here, latest version. It seems to start at 1st of December. Seems to be an early Christmas gift from goggle. I've just tried some old URLs from my speed test which sill works fine.

Same issue here, latest version. It seems to start at 1st of December. Seems to be an early Christmas gift from goggle. I've just tried some old URLs from my speed test which sill works fine.

This just broke last night for me as well. The "stream a url" still works. But I have to many items to change to the url format.
http://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=this%20is%20a%20test&tl=En-US

same here

If this helps... same here

Indeed, same problem here.

SAME ISSUE! the problem started a few weeks ago (after update?). I noticed that the message was processed without error on the second attempt and first set the alert sound and after 5 seconds the message. About four days now - 95% of requests for the cast node with an error "Not able to get media file via google-tts:get token key failed from google"...

I recently swapped to node-red-contrib-castv2 which does the same thing for my purpose without any issues. Same TTS voice, similar usage.

Since this is dead for all of us.. anyone got an alternatives?> I tried the Microsoft TTS but it fails on connection. Super annoyed I have to change all my node red automations because of this.

i moved to node-red-contrib-castv2 too. had to rejig some of nodes to use this but overall good replacement.

I recently swapped to node-red-contrib-castv2 which does the same thing for my purpose without any issues. Same TTS voice, similar usage.

It uses google-tts, so you will get the exact same problem with this node?

@DidrikN no because casev2 was already updated and bug was fixed there few days ago.

i'm still having this bug in Node-red HA

"Not able to get media file via google-tts:get token key failed from google"

guys, unless it is fixed in current code it will not work.
If you can't wait, you can install https://flows.nodered.org/node/node-red-contrib-castv2 where it has been fixed few days back.

All my Google TTS routines have broken as well, I hope they can fix it at some point, I don't fancy reconfiguring my entire Home Automation system to work with castv2 instead.

#107 (comment)

I spent last night upgrading my system to use castv2 instead (and at the same time made it easy to switch back to cast later on). I simply created a sub flow for each of my GH-devices containing the following code:
image

[
{
"id": "de753fa.fa178c",
"type": "castv2-sender",
"z": "8c196abc.1934b8",
"name": "Google Nest Hub Max Kitchen",
"connection": "77eb755b.8fc64c",
"spotifyAccessToken": "",
"spotifyAccessTokenExpiration": "",
"spotifyDeviceName": "",
"x": 980,
"y": 160,
"wires": [
[]
]
},
{
"id": "ee7564df.27c558",
"type": "function",
"z": "8c196abc.1934b8",
"name": "Setup message",
"func": "\nvar temp = msg.payload;\n\nvar currentLanguage = "sv";\nif( msg.language != null ) {\n currentLanguage = msg.language;\n}\n\nreturn {\n payload: {\n text: temp,\n type: "TTS",\n language: currentLanguage\n }\n};",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 680,
"y": 220,
"wires": [
[
"de753fa.fa178c"
]
],
"outputLabels": [
"Google Home Notification"
]
},
{
"id": "3a287db4.3a4e42",
"type": "function",
"z": "8c196abc.1934b8",
"name": "Set volume",
"func": "var temp = msg.volume;\n\nreturn {\n payload: {\n type: "VOLUME",\n volume: temp // 0 to 100\n// volume: 40 // 0 to 100\n }\n};",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 550,
"y": 160,
"wires": [
[
"de753fa.fa178c"
]
],
"outputLabels": [
"Google Home Notification"
]
},
{
"id": "206949e9.480bf6",
"type": "delay",
"z": "8c196abc.1934b8",
"name": "",
"pauseType": "delay",
"timeout": "100",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 430,
"y": 220,
"wires": [
[
"ee7564df.27c558"
]
]
},
{
"id": "77eb755b.8fc64c",
"type": "castv2-connection",
"name": "Google Nest Hub Max Kitchen",
"target": "",
"host": "192.168.1.216",
"port": "8009"
}
]

You will note that I changed default language to Swedish, but I could more or less directly re-use my already existing automation that already was forwarding a request like below to make a notification (code is for an injection node):

[
{
"id": "d63a08bb.9b18e8",
"type": "inject",
"z": "956ec74f.0465b8",
"name": "English message",
"props": [
{
"p": "payload"
},
{
"p": "volume",
"v": "70",
"vt": "num"
},
{
"p": "language",
"v": "en",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Papa was a rolling stone",
"payloadType": "str",
"x": 380,
"y": 380,
"wires": [
[
"9cf0d864.b50788"
]
]
}
]

I just have this one flow for node-red-contrib-cast. I have no idea how castv2 works, I've never used or looked at it.

image

Its dynamic. I can send different HTTP commands from my Home Automation system to it.

Where I specify the TTS text and the IP address of the Google Home speaker I want to target in the URL.

For example say "This is a test" and send to the Home speaker with the LAN IP 192.168.1.16

http://NODE-RED-IP:1880/sceneTrigger?message=This%20is%20a%20test&ip=192.168.1.16

Or send a TTS to multiple Google Homes:

http://NODE-RED-IP:1880/sceneTrigger?message=This%20is%20a%20test&ip=192.168.1.16|192.168.1.17|192.168.1.18

Function Node - Code:

var IPS = msg.payload.ip.split("|");
for (var i in IPS) {
msg.payload = {"message": msg.payload.message, "ip": IPS[i], "volume": msg.payload.volume};
node.send([null, [msg]]);
}
msg.payload = "ok"; // the response message
return [msg];

OK I've switched to the CastV2 node instead for TTS announcements.

See here for how I did it:

i8beef/node-red-contrib-castv2#46 (comment)

Note the castv2 fix is a hack, but no worse than what any other usage of the translate API for TTS does. The google-tts package isn't super complicated, and the way it tries to grab a token isn't strictly necessary right now (until Google breaks it again). All I did was bypass that and generate the URL myself (which this node could easily do too, just drop google-tts as it isn't really doing anything for you).

Its important to note that if Google ever decides to lock this down correctly, we're ALL screwed without another free TTS generation approach.

As 0 to 4 million characters / month are worked for free by GoogleTTS API,a way could be to implement a private key inside the node..

I have the same problem in node red also started 1 Dec
I run a template nodes to cast the time and and greeting from a template node
The above example gives errors so far no resolve yet, i have started to download the test to speech files in the tts folder in hassio to more go the offline path in future.

Note the castv2 fix is a hack, but no worse than what any other usage of the translate API for TTS does. The google-tts package isn't super complicated, and the way it tries to grab a token isn't strictly necessary right now (until Google breaks it again). All I did was bypass that and generate the URL myself (which this node could easily do too, just drop google-tts as it isn't really doing anything for you).

Its important to note that if Google ever decides to lock this down correctly, we're ALL screwed without another free TTS generation approach.

a working hack is better than non working code at all. :)

It is working for me, thank you!
โ€ฆ
On Tue, Dec 8, 2020 at 2:32 PM Hypnos @.***> wrote: I have published a new Version and I need somebody to test if this works. โ€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#123 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBAUWREWNFPR5NRFPNMNBDST2EPDANCNFSM4UIM3MZA .

hi, I am stuck in the same boat with using the old cast node. it was easy to set up in node red with my google mini IP address and the message i wanted it to say. with the new v2cast its diff. to set up to just do a simple tts can you please help?

It is working for me, thank you!
โ€ฆ
On Tue, Dec 8, 2020 at 2:32 PM Hypnos @.***> wrote: I have published a new Version and I need somebody to test if this works. โ€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#123 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBAUWREWNFPR5NRFPNMNBDST2EPDANCNFSM4UIM3MZA .

hi, I am stuck in the same boat with using the old cast node. it was easy to set up in node red with my google mini IP address and the message i wanted it to say. with the new v2cast its diff. to set up to just do a simple tts can you please help?

I meant that this node is working now with version 0.2.17. I'm not using V2.

@Shannondalebreaux To be clear, castv2 is a completely different node / developer (me) just based on the Cast V2.0 protocol (i.e., its not V2 of THIS NODE, its a parallel implementation with a different model). If you have questions on that node, please head over to that node's Github and I'll be happy to help you, but lets not clutter up this issue tracker with unrelated questions. ๐Ÿ˜„

I can also confirm that as version 0.2.17 of the node-red-contrib-cast its working again and fixed for TTS announcements.

However as I've switched now I think I'll be sticking with CastV2.

Thanks

As it seems to work with the update of yesterday I close the issue.

has not been fixed, it keeps giving error after the update

It works for me

For me works too

error seems to have returned

Yes same error, streaming mp3 works,TTS not.

TTS is still working OK for me with node-red-contrib-cast

TTS is still working OK for me with node-red-contrib-cast

thanks for the feedback: updated to last version and now works fine

N5A commented

0.2.17 stopped working about 3 weeks ago. Early May. I get the error... -- "Not able to load media:Load failed Not able to load the media." --

I have 3 google home or chromecasts.

Identical nodes with node-red-contrib-cast work for a google home mini and a chromecast with google-tv, but the third give the error message "Not able to load media:Load failed Not able to load the media." It plays the alert ping before the message though, like the other devices.

I can play youtube audio and spotify on the units, also from catt.

My TTS also stopped working "Not able to load media:Load failed Not able to load the media."
Just plays the alert beep sound. I can stream audio with it.

TTS also stopped working for me, it indicates a load media error

My TTS also stopped working "Not able to load media:Load failed Not able to load the media."
Just plays the alert beep sound. I can stream audio with it.

Today it started working again. There is more information about this problem reported over at castv2: i8beef/node-red-contrib-castv2#64

You can see a lot of people reporting that its caused by the Google API and not node red