Google Assistant Relay and cUrl commands

I have successfully installed V2 of the Google Home Relay on an rPi and have been trying to get broadcasts to send to the server running at a local IP on my LAN. If i use telnet to send a cURL it works fine. I.e.

curl -d '{"command":"This is a test", "user":"username", "broadcast":"true"}' -H "Content-Type: application/json" -X POST http://192.168.1.111:3000/assistant

I have tried a relay driver from ogiewon but cannot get it to work, even after trying to incorporate the updated destination URL to include the directory.

I would just as well use a cUrl command as formatted so I was wondering if there was a way to do this by writing a simple app that would allow a user to supply variables to assemble a cUrl command that could be sent with a RM trigger.

I have searched the forums but am coming up empty handed.

1 Like

I believe @ogiewon has not updated the driver for the v2 and was not planning to any time soon. I don't think there are significant advantages to running v2 Assistant Relay, so you would be better off loading V1.

I'm still running v1 and it's working great. No issues.

You should be able to modify my current driver to comply with the new v2 requirements. If you do decide to take on this challenge, it would be great if you included a switch to allow it to work with either v1 or v2 assistant-relay servers. :slight_smile:

Yea I ordered a Google Home Hub... I want a serverless relay lol
Please Santa? :stuck_out_tongue_winking_eye:

1 Like

I'm actually looking through the V1 post on ST and I don't see the original V1 source code... I'm probably just missing something...

I forked it in my GitHub repo when it was still v1.

Thanks mate!

Now we need a docker Pi image. :wink:
Then I'd feel like Santa satisfied my needs. :smiley:

So I thought I had done that via a fork from your master on github, but I still am not getting any TTS output from the device when I click "speak" in the device.

All I did was create a new input to allow people to add a directory after the port of the server that defaults to "/assistant" and if the input is blank, use the V1 logic.

Still, no go Hubitat/V2.X Driver at master ยท nrmoles/Hubitat ยท GitHub

I would recommend using the Device Notification capability rather than speak. That's what I used for the Cast-Web-Driver. I like Cast-Web better because you can use it to control the volume on your GH speakers through HE. For example, when my bathroom light turns off, it turns the volume back down from the level i have while in the shower back down to a reasonable level.
If you're interested in trying, I can post links to the code.

That would be fantastic. I would like to do just what you described with my bathroom mini, but I also would like to be able to have a broadcast of TTS triggered when my toddler's door opens during specific hours so I know when she is out of bed or when someone opens my front door.

Much appreciated!

Yup...here's the link to the adapted drivers and smart-app.
https://github.com/ryancasler/Hubitat_Ryan/tree/master/cast-web-api

And to get the code for your server, just run:

sudo npm install cast-web-api@beta -g

Then you'd have to use standard methods to start it and start it again at reboot (i.e. rc-local or create a systemctl service). If you don't know what the hell I'm talking about, just let me know and I'll post more details. Once you install the driver and app and server, you have to authorize the server the same as you go assistant-relay but you don't have to create any users. You also don't need to create a second project or oauth credentials, both servers can use the same one.

Once installed and devices are synced, you can use the notification capability to send a broadcast to all cast-web speakers or you can pick an individual one and use the "Speak" command to send something to that speaker only as a "cast" message. FYI, the "cast" message will cause whatever is playing on the speaker to stop because it is basically casting another file for the device to play. That's why I stick to the broadcasts via notifications as much as possible.

1 Like

Ok I got it installed and running using forever start 'cast-web-api' and when I go to http://192.168.1.XXX:3000 I get a response of { "cast-web-api" : "v1.1.0-rc19" } so I can tell I'm i business there, but I am not getting prompted to authorize with google. Do I need to manually copy my OAuth file to a location in /usr/local/bin/cast-web-api to get it to prompt for that?

Thanks for the assist, this looks great

Nope...just go ahead and add the drivers and app....then install the app and it will walk you through authorization. Just click on this:

And you'll be walked through setup. Then you can discover your devices and whatnot. Supports all devices that support "cast" so Chromecast Audio and Video and all GH devices and devices with "Assistant Built In".

Great, thanks for the help Ryan, I walked through the setup no problem, supplied my ClientID, secret, etc., and now can see all of my GH devices. Just have to update my rc.local on the rPi and I think I am done.

This community has made getting migrated from ST pretty darn easy

1 Like

You ordered a GH hub? I thought you ordered a homepod :stuck_out_tongue_winking_eye:

1 Like

I'm offended by Apple ATM. I can't bring myself to leave iOS and Apple TV but the Homepod and the new iPhones really urk me, Home Hub seems awesome.

2 Likes

I got this error when I clicked on "setup the google assistant with webcast....
"GoogleAssistant not installed, error: Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild" Original error: Cannot find module '/usr/local/lib/node_modules/cast-web-api/node_modules/grpc/src/node/extension_binary/node-v59-linux-arm-glibc/grpc_node.node'"

I was able to add a couple speakers and got them to play text

What version of Node are you running on your cast-web server?

9.9.0