[Release] Assistant Relay V3 - Google Home Audio Notifications!

image

ASSISTANT RELAY V3

Following on from V2 of Assistant Relay, I’ve given it a total overhaul and rewrite which should resolve a lot of the issues in V2.

Unfortunately, it’s still restricted by the Google Assistant SDK limitations, however I’ve removed the requirement to configure this using configuration files and command line interactions.

There’s a new web interface that should be accessible from anywhere on your network, and there’s also a new sandbox where you can test out your requests and look and listen to the responses from Google Assistant.

What is this?

  • This isn’t an extension of your Google Home
  • This isn’t some fancy local API that connects directly to your Google Home
  • This is a Node.js server that uses the Assistant SDK
  • This is basically another Google Home device, but without a microphone and speaker

What can I do with this?

Assistant Relay is a Node.js server that will accept requests, and then process them. These might be broadcast requests, predefined statuses or routines. It accepts text entry and then does something with it.

As an example, open up Google Assistant on your phone and then type broadcast hello world . Your Google Home devices will now announce “hello world”.

There are lots of things you can do such as:

  • Send broadcasts, useful if you want to announce that the back door has been opened
  • Get personal information from your Google account - maybe you want to know what’s on your calendar
  • Get answers to any question you want (within reason)

As this isn’t a SmartThings DTH or SmartApp, you can also hook this into anything you want

  • Send broadcasts from your phone to Google Home if your phone rings using Tasker
  • Send a predefined movie announcement using WebHooks from Plex when a movie starts
  • Send an announcement that dinner is ready when your smart over timer goes off

Supported Systems

Assistant Relay relies on the Google Assistant SDK, therefore it only currently supports x64_64 or ARMv7 processors. It should work on the latest Raspberry Pi’s with an ARMv7 chip. Check the below pages for more information


Installation

What you need

I’m not going to run you through how to get Node.js running on your device as there are hundreds of guides out there on how to do this. http://thisdavej.com/beginners-guide-to-installing-node-js-on-a-raspberry-pi/

Follow the installation section on the Github report to get started. It will log out the URL to access the web interface. Alternatively, you can go to the http://[ip of device]:3000

Assistant Relay runs on port 3000, but it’s already taken. Now what?

Stop the Assistant Relay server by using pm2 stop [pid] or pm2 kill to kill pm2 completey.
In the release download, go into the bin folder and create a file called config.json. Copy the below code in, set the port, save the file and restart the Assistant Relay Server

{
  "port": 3005
}

How To Use

You can now make a call from WebCore, Tasker, IFTTT or anything else. I’ll share some of my Postman examples below:

WebCore


Above is an example of how to call Assistant Relay and pass data to it using variables.

Sending Requests

V3 uses the same endpoints as V2. If you’re upgrading, your existing Assistant Relay calls will still work.

Audio Responses

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.

What’s New?

Keep an eye on the Github ReadMe for all the latest updates


Upgrading from V2

There is no upgrade path as it’s not really something required. Just keep your auth files safe, trash your existing install and then start fresh with V3.


Bugs and Requests

Could you use the Github repo to add any bugs or feature requests please. It’s too difficult to track them here:

4 Likes

I want to send a text command to Assistant to turn off a TV through a Chromecast by pushing a button or using a timer in Smartthings.
It looks like this is possible and has to be done through WebCore, is that correct?

Yes, you could use this, however I don’t know if the SDK will restrict you from doing this

Could I test it somehow before setting all of this up?

I tried following the installation instructions but I have no idea what’s going on.

I installed node.js on my Windows laptop, installed PM2 using Powershell, downloaded the release from Github, opened Powershell from the release folder, and then stumbled.

I feel like there’s a lot unsaid with this instruction: “then use npm i to get started.” Where am I supposed to use that command and how?

I’m sorry. I’m not an intermediate Linux user. I’m barely a beginner. I have 18.04 running on a spare pc I have.

I got as far as npm run start (with a LOT of failed tries, all my fault) and now have:

mylinux@nottelling:~$ npm run start

relay@0.0.0 start /home/mylinux
pm2 start ./bin/www && pm2 log www

[PM2] Spawning PM2 daemon with pm2_home=/home/mylinux/.pm2
[PM2] PM2 Successfully daemonized
[PM2][ERROR] Script not found: /home/mylinux/bin/www
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! relay@0.0.0 start: pm2 start ./bin/www && pm2 log www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the relay@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/mylinux/.npm/_logs/2019-11-07T16_05_41_483Z-debug.log

You need to run these commands inside the assistant-relay directory

I do not see an assistant-relay directory. Is this something I was supposed to create? Where?

You must have download assistant relay and extracted it to a folder somewhere? Thats the folder you need to be in to run the commands

I just extracted it in the download folder. LOL I guess I’m used to windows creating a folder, but not so much here! I’ll try again, thanks!

Oh, I assume it should be in the Home/mylinux folder, yes? So: home/mylinux/assistant-relay/

Ugh. Fighting every step. Ok, created the folder, unzipped…

and there it sits…

Odd, seems to suggest it can’t get out to GitHub. I assume you have network connectivity

Yep, I do. Not FAST… DSL, but it’s there.

I rebooted and ran npm run start again. got the same, then a second later I got green text with “Initialized” and “Visit XXXX website to initialize”! Woo!

Now, to continue blindly in the dark at midnight… Thanks!

Whew! Ok, I’m at Step 2 Adding Client Secrets. With your client secrets, you can import them into Assistant Relay below: And it’s asking for a “Users Name” with a select file button after that box.

I don’t understand what that means.

(EDIT) Ok, I think that’s the file I downloaded, and doing some looking at the Assistant Relay readme, it looks like I need to rename it to “Your chosen User Name”. And then make a copy and place it in server\configuration\secrets.

Ok, so “your chosen user name”. Is that just my name, is it my google email address before the “@”, or is it a name i can make up?

Next, where is server/configuration/secrets ?

You’re reading the wrong version:

I’m really sorry. I’m trying to get this. I feel really stupid, but this is like nothing I’ve ever done, and I really want to succeed.

Terminal popped up with a website to go to, which I did. Has “Step 1, setting up your project” and there are 8 bullet steps, which I did, then a next button. So, according to what you linked, I do not go ON to step 2. I now have to Visit the configuration tab on Dashboard to Configure.

Edit: I’m on the Google APIs Dashboard, but i don’t see a “Configuration tab”.

WHAT DASHBOARD???

What version have you downloaded? You need to be on version 3. Sounds like you’re reading instructions for V3 and running V2

I went into the assistant relay folder and looked at the readme file, it says V 3

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.