i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

Suddenly one of my google home devices wont play TTS #63

Closed jbrown123 closed 3 years ago

jbrown123 commented 3 years ago

I've had this working with Node-Red for quite a while (months). Suddenly a few days ago one of my google homes quit talking. It plays the I'm-about-to-say-something notification sound but then nothing else.

Other devices using the same code path (attached to the same TTS switch node) speak just fine as they always have.

Another interesting anomaly. I have several speaker groups defined. If I send to a group that includes this speaker, it fails for the entire group and no units in the group speak. If I send to a group that does not include this device, it works fine as expected.

I tried upgrading to the latest version of castv2 and it didn't fix anything. I've tried deleting and re-adding that particular device but that also didn't make a difference. I tried rebooting the device (power cycle) and still the same.

I have several flows (4) that talk to this device. I thought perhaps too many connections was the issues. I deleted all the instances except my test instance (see below) and that also didn't change anything.

Alarms, timers, and broadcast from other speakers work just fine on this unit. Just the TTS output from castv2 has problems and only on this one device.

As far as status output, the node status (caption below the castv2 node) goes from "connected" to "joined" to "error". The change to "error" occurs right as the notification sound is played on the speaker. I also get an error in the debug console but it's not very helpful. It says msg : error "Error: Load failed".

The failing device is an older full sized google home. I have another full sized google home of roughly the same vintage / age that works just fine using the same output.

I created a simple test flow to try to debug the problem. It has the same issue.

My test config is an inject node -> change node -> castv2 node.
  inject node sets msg.payload to string "test speaker output"
  change node config: set msg.payload to J:expression `{"app": "DefaultMediaReceiver", "type": "TTS", "text": payload}`
  castv2 node left at defaults except the device which I picked from the search results.

Here's a copy of the test flow:

[{"id":"c27e30fc.c30c","type":"change","z":"648265c8.cf0d8c","name":"TTS for cast","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"app\": \"DefaultMediaReceiver\", \"type\": \"TTS\", \"text\": payload}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":980,"wires":[["2c60227.28818de"]]},{"id":"43847ecd.96097","type":"inject","z":"648265c8.cf0d8c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Test speaker output","payloadType":"str","x":170,"y":980,"wires":[["c27e30fc.c30c"]]},{"id":"2c60227.28818de","type":"castv2-sender","z":"648265c8.cf0d8c","name":"Living room","connection":"ebd998c1.a7f108","x":550,"y":980,"wires":[[]]},{"id":"ebd998c1.a7f108","type":"castv2-connection","z":"","name":"","target":"Living Room speaker","host":"","port":"8009"}]

I'm happy to help debug in any way I can. Just let me know what you need me to do.

i8beef commented 3 years ago

Load failed is Google's message back telling the node that it failed to load the URL sent to it. That URL will be: https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=en&ttsspeed=1&q= + your text URL encoded. The node has validation for the message being longer than 200 characters, which is the only limitation I'm immediately aware of...

But if you can send the exact same message to other targets and it's fine, it sounds like there's something off about your Google Home unit... that's a black box here, so I don't even know where to start.

Might try factory resetting the Home and starting over with it? Can you cast from other apps to it?

jbrown123 commented 3 years ago

That message definitely works with other google home devices using the exact same output from my TTS conversion node (change node) so I don't think the URL is incorrect.

I can cast from other apps to the failing Home device (audio, etc.). It properly alerts for timers for example which is a very similar case.

I can try factory resetting it and re-add it to my network. I'll get back to you after I've done that.

i8beef commented 3 years ago

I would more be looking at media casts... for instance finding an MP4 online and sending that like this:

{
  payload: {
    app: "DefaultMediaReceiver",
    type: "MEDIA",
    media: {
      url: "http://test.com/media.mp4"
    }
  }
}

There's one called "Big Bucky Bunny" that gets used a lot for this sort of testing because its been encoded specifically for such testing... if you search around you can probably find a good URL for that you can try. This would prove the Google Home cast instance can actually play media in general.

It would be awfully weird for it to be something like a Google Home not being able to talk to translate.google.com specifically... so playing media from some other domain would at least point at it being specifically related to the URL you sent it. Timers and such are a different animal, those are Google Home core functionality, not the embedded cast device.

jbrown123 commented 3 years ago

I can't get MEDIA to work at all, even on speakers that work with TTS.

I get back msg : error "Error: Unknown command"

Here's the payload I'm sending. Tried other MP3's as well with the same result.

{
    "payload": {
        "app": "DefaultMediaReceiver",
        "type": "MEDIA",
        "media": {
            "url": "https://archive.org/download/BigBuckBunny1280x720Stereo/big_buck_bunny_720_stereo_64kb.mp3"
        }
    }
}
jbrown123 commented 3 years ago

Factory reset of the offending google home fixed the TTS problem. I still can't play any media on any device but that's not an issue for me at the moment so I'm going to close this issue.

If you want to trace down the media issue, I'd say open a new issue for that.