SmartThings Community

[Release] [Closed] Google Assistant Relay V1 - Google Home Audio Notifications!

tts
requires_server
project_alerts
project_voice
googlehome
(Tommy Strømme) #1094

Sounds pretty smooth! I’ll have a go at this after work today. You dont happen to have a link to a guide to get it setup? Can it utilize the same server as the Google Assitant Relay?

Tommy

1 Like
#1095

If you’re using a Pi, you can get it installed on the same Pi. Just make sure you change the port as both the relay and cast api is using the same port. You can get the instructions here:-

1 Like
(Greg) #1096

You can run as many instances of anything as you want. You could have 3 Assistant Relays and 3 Cast APIS on the same server, just configure a new port for each instance

(Greg) #1097

Version 2.0 is making quite a bit of headway now. Some major changes and features are:

  • JSON responses for all requests
  • JSON responses include the return text message from Google Assistant
  • Automatic configuration of users
  • Audio files from Google Assistant are now available and hosted by Assistant Relay

Currently a work in progress:

  • Local Web Dashboard to send requests
3 Likes
(Charles) #1098

As soon as I get some free time, I want to do this exact thing: both @ghesp’s relay (which I have running) and this casting ability. Between the two, they would seem to cover all my announcement needs

#1099

I’ll have to give it a try while keeping v1 as prod

#1100

Installed it and it worked for a couple of minutes before throwing me these errors :

(node:19024) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Service unavailable.
(node:19024) [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.

Any clue?

(Greg) #1101

Just deployed an update, but like I say its a WIP.

Things work a bit different now though.

Rename your OAuth file to your username.json, and put it in server/configuration/secrets.

Its just a single POST to /assistant:

command is what you want to say to the assistant. “Tell me a joke” or “This is a broadcast”
broadcast should be true or false. If true, it will broadcast the command sent
user is the name of the user
converse should be true or false. Will make the assistant talk the response
preset is the name of the preset broadcast. Will override the above

#1102

Hey @ghesp

Are you planning on adding broadcast to a single device / group in v2? I’ve always wanted my Kitchen home to respond to “good morning” when I walk in first thing in the morning.

Thanks,
Kev

(Greg) #1103

I would do, but the functionality from Google doesn’t exist so I cant :frowning:

#1104

That’s a shame. Thanks for looking into it though.

Is there an open request on the API for single device / group activation?

(Greg) #1106

Version 2 is in what i’d call a Beta State now and is available under the V2 branch here:
https://github.com/greghesp/assistant-relay/tree/v2

If you’re using WebCore, you will need to slightly reconfigure your pistons, as Assistant Relay now accepts the data in a JSON encoded format!

This actually makes the integration with SmartThings more dynamic as you can now do change the parameters on the fly.

Simple set the parameters as variables, and then change the piston to send the data as JSON and send the variables like so:

In the example above, you could change the user variable in WebCore based on an external parameter, and when Assistant Relay is called, it would send the new user.

Another example could be a door open announcer where you have 1 call to Assistant Relay, and in your piston it sets the command to say which door has been opened

Volume Control

You can now set volume levels. Just send as a command “set volume to x%” and it’ll do it for you

Now the awesome bit

Hats off to whoever sent me their code on github, as it inspired me to get this one sorted.

If you use something like cast-api, Sonos or any other network connect speaker, you can now send your Google Assistant audio responses to specific devices. It’s not the same as a broadcast, so it will interrupt whatever is happening but its the best we have at the moment.

In the below example, I am making a request to Assistant to tell me about my day. Assistant Relay saves the audio file and sends a URL to listen to it back in the response.

What you can then do is tell a speaker to play that URL from the response, and it will play the Google Assistant response.

I am working on getting it to broadcast this audio without the need for cast-api or another network speaker, but its a bit of a hack, and right now, I cant get the SDK to accept my audio files.

3 Likes
#1107

That looks very promising, thanks again for doing that.

I’m testing v2 since maybe Thursday. Stupid question: what would be the best way to update local files to latest version? Wouldn’t git pull overwrite config and secrets file?

(Greg) #1108

I’d just download/clone it into a new directory to be honest. Its a huge overhaul, practically nothing from V1 has been kept as it was/

#1109

Yeah that’s what I did earlier this week. Now I’m just looking to update to the most recent files you updated like yesterday or Friday. Thanks!

(Greg) #1110

Did you git clone? If so, just do git pull and it should be OK

#1111

Yup I git clone. Alright I’ll git pull. I’m kinda new to git and Linux so I thought it would overwrite configs with what’s in the repo.

#1112

Hi Greg. I have a different home-automation system but your Google Assistant Relay sounds very exciting.

I wish to understand how specifically the Google Assistant Relay is tailored to the SmartThings ecosystem?

To put this in context, I have a home automation system called Loxone that runs their proprietary environment. There is a community of enthusiasts who have put together an ancillary system called Loxberry that complements the Loxone system. It is a Raspberry Pi with a cut-down Raspbian operating system.

The Loxberry fills the gaps between various commercial systems that Loxone was not designed to communicate with. It also provides capabilities not otherwise available in the stock system.

I wish to see if I can ‘port’ your Google Assistant Relay onto the Loxberry device (or more specifically employ a programmer to!). The Loxone system communicates with the Loxberry with POST commands and payload. Is your device with Google Assistant Relay a receptor for POST commands from the SmartThings device?

Or does the integration go further than that?

(Greg) #1113

It shouldn’t do, as there is a .gitignore on the tokens and secrets folder

@Tico1 There is nothing specific to SmartThings here. Since SmartThings doesn’t send POST commands natively, we use a SmartApp called Webcore to do this for us. I built it specifically so it could be used by any platform. It’s simply a Node.js server you can run on a local device, and then just send HTTP requests to.

Just install Assistant Relay, and then send the POST commands from Loxone to the Relay and it’ll do its thing :slight_smile:

1 Like
(Dan) #1114

Greg,

First, thank you for your continued work on assistant-relay. I have really enjoyed using it over the past few months.

Have you considered using a virtual device (could be a child device of your discovery smartapp) to implement the SmartThings Notification and/or Speech Synthesis Capabilities? Doing so would allow any SmartApp that supports these capabilities to use the assistant-relay without requiring webCoRE.

Since you have the hood open on the project, I thought you might like to consider this.

As an example, here is the Hubitat Driver I wrote to allow Hubitat users to use your assistant-relay on that platform. It is pretty simply, but does a nice job of abstracting the http calls for the end users.