SmartThings Community

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

tts
requires_server
project_alerts
project_voice
googlehome

(Kebel87) #1217

Easier, certainly! I wouldn’t venture into running assistant on AWS for the very reason you pointed out. But still, it’s doable while not recommended.


(cjcharles) #1218

Step 6 at the bottom missed sudo - only sudo npm install worked for me, despite the default pi user having admin access. Just an FYI.

I tried with the default version of 10.10 which came with Raspbian Stretch, but it didnt work at all. I found 9.9 worked for me well so Im currently sticking with that! Might be worth adding the node-install plugin to your instructions as it was a great way to switch versions!
EDIT: If you install Node with node-install then it uses a symlink in order to put Node in the right place, hence when you install forever you will not be able to use it easily. This is because you would be installing forever in the location of node, as opposed to its symlink location. In order to add a symlink to forever you will need to type * sudo ln -s /opt/nodejs/bin/forever /usr/bin/forever * where the opt/nodejs/bin/forever part might change, but hopefully that is the normal location where nodejs is installed

@ghesp - I believe your SSDP instance does not update to include specified port and remains advertising port 3000. Probably not a problem for most things, but just an FYI. Thanks again for all your work on this! So good to have it back up and running.

Thanks got the welcome message so will now have a play and confirm all is now running smoothly.


#1219

the zip seems to be missing the/node_modules/speaker directory and causes the following error during npm install:

pi@raspi3:~/assistant-relay-master $ npm install
npm WARN notice [SECURITY] deep-extend has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=deep-extend&version=0.4.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] hoek has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=hoek&version=2.16.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] protobufjs has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=protobufjs&version=5.0.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=lodash&version=4.17.4 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] sshpk has the following vulnerability: 1 high. Go here for more details: https://nodesecurity.io/advisories?search=sshpk&version=1.13.1 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] stringstream has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=stringstream&version=0.0.5 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.

> speaker@0.3.1 install /home/pi/assistant-relay-master/node_modules/speaker
> node-gyp rebuild

make: Entering directory '/home/pi/assistant-relay-master/node_modules/speaker/build'
  CC(target) Release/obj.target/output/deps/mpg123/src/output/alsa.o
../deps/mpg123/src/output/alsa.c:19:28: fatal error: alsa/asoundlib.h: No such file or directory
 #include <alsa/asoundlib.h>
                            ^
compilation terminated.
deps/mpg123/output.target.mk:108: recipe for target 'Release/obj.target/output/deps/mpg123/src/output/alsa.o' failed
make: *** [Release/obj.target/output/deps/mpg123/src/output/alsa.o] Error 1
make: Leaving directory '/home/pi/assistant-relay-master/node_modules/speaker/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.14.62-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/assistant-relay-master/node_modules/speaker
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

> grpc@1.8.0 install /home/pi/assistant-relay-master/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

[grpc] Success: "/home/pi/assistant-relay-master/node_modules/grpc/src/node/extension_binary/node-v57-linux-arm-glibc/grpc_node.node" is installed via remote
npm WARN assistant-relay@1.0.1 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: speaker@0.3.1 (node_modules/speaker):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: speaker@0.3.1 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 140 packages in 201.505s


(Greg) #1220

You need to run npm i


#1221

Hi Greg, Im not sure what Im missing.

I tried what you suggested and got the following:

pi@raspi3:~/assistant-relay-master $ npm i

> speaker@0.3.1 install /home/pi/assistant-relay-master/node_modules/speaker
> node-gyp rebuild

make: Entering directory '/home/pi/assistant-relay-master/node_modules/speaker/build'
  CC(target) Release/obj.target/output/deps/mpg123/src/output/alsa.o
../deps/mpg123/src/output/alsa.c:19:28: fatal error: alsa/asoundlib.h: No such file or directory
 #include <alsa/asoundlib.h>
                            ^
compilation terminated.
deps/mpg123/output.target.mk:114: recipe for target 'Release/obj.target/output/deps/mpg123/src/output/alsa.o' failed
make: *** [Release/obj.target/output/deps/mpg123/src/output/alsa.o] Error 1
make: Leaving directory '/home/pi/assistant-relay-master/node_modules/speaker/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.14.62-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/assistant-relay-master/node_modules/speaker
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

> grpc@1.8.0 install /home/pi/assistant-relay-master/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

[grpc] Success: "/home/pi/assistant-relay-master/node_modules/grpc/src/node/extension_binary/node-v57-linux-arm-glibc/grpc_node.node" is installed via remote
npm WARN assistant-relay@1.0.1 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: speaker@0.3.1 (node_modules/speaker):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: speaker@0.3.1 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 343 packages from 186 contributors and audited 819 packages in 437.182s
found 38 vulnerabilities (2 low, 31 moderate, 5 high)
  run `npm audit fix` to fix them, or `npm audit` for details

(Dan) #1222

Did you install the following as a prerequisite?

sudo apt-get install -y libasound2-dev


#1223

Thanks guys I followed these instructions and made a lot more progress.

Im now only getting an error on the last step when calling index.js

pi@raspberrypi:~/assistant-relay $ node configBuilder.js
What do you want to do? (Enter 1 or 2):
1) Add User
2) Change port
Number: 1
prompt: Name:  jon
prompt: Client Secret File Name:  jon_client_secret.json

            Your config file has now been saved!
            When needed, use the username jon to send Google Assistant commands from this users account


pi@raspberrypi:~/assistant-relay $ node index.js
module.js:545
    throw err;
    ^

Error: Cannot find module 'C:\Users\greg_\Documents\Node\assistant-relay\greg_client_secret.json'
    at Function.Module._resolveFilename (module.js:543:15)
    at Function.Module._load (module.js:470:25)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
    at new Auth (/home/pi/assistant-relay/node_modules/google-assistant/components/auth.js:26:15)
    at new GoogleAssistant (/home/pi/assistant-relay/node_modules/google-assistant/index.js:21:16)
    at /home/pi/assistant-relay/index.js:175:26
    at replenish (/home/pi/assistant-relay/node_modules/async/dist/async.js:1011:17)
    at /home/pi/assistant-relay/node_modules/async/dist/async.js:1016:9
    at Object.eachOfLimit (/home/pi/assistant-relay/node_modules/async/dist/async.js:1041:24)
    at Object.<anonymous> (/home/pi/assistant-relay/index.js:173:7)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
pi@raspberrypi:~/assistant-relay $

(Greg) #1224

You’re running version 1, run version 2 as it’s the latest version


(Kebel87) #1225

so v2 is now considered as stable enough for daily use?


(Greg) #1226

Yep, should be. I’ve been using it here for a few weeks now without issue


(Rob Whapham) #1227

I’ve been using this for a few weeks now, and, aside from a few instances were the broadcast isn’t received by one of my minis (which I’m fully convinced is a Google issue), it works like a champ. I would like to expose its port through my router for WebHook integration with IFTTT, and so would like to make a feature request to make that hole a little more “secure”. Can an access token be generated locally (a GUID/UUID works just fine) that is required in all POST requests to be considered valid? That way, it adds one more thing to keep an outsider from exploiting an open port. Just a thought.


#1228

Thanks Greg. How do I upgrade to V2? Any chance of updating the initial post to include all this info? It would make life easier on the noobs like me!


(Greg) #1229

If you’re already running V1, best bet would be to store your secret json files in a safe place, and then just download V2 and start again.

V2 is pretty straight forward, all details are here:


(Greg) #1230

V2.0 has now been pushed to the master branch on Github. I am no longer supporting V1 so I am closing this thread.

A V2 thread can be found here:
https://community.smartthings.com/t/release-google-assistant-relay-v2-0-google-home-audio-notifications/136473/2


(Ram) #1231

Hi Guys, I’m new to Raspbian and easy on me. I just got the pi 3 B+ and setting up one by one.

I’m running node.js version 8.

I was in the process of setting up the Assistant relay and running the program. After the setup and ran the command npm run start and got the following message but my connection is getting refused and not sure why it is…

Assistant Relay is now setup and running for ram

You can now visit http://192.168.XX.XX:3000 in a browser, or send POST requests to it

This is the error when I try to send the message.
This is what I passed on the terminal:
curl -d ‘{“command”:“hello world”, “user”:“ram”, “broadcast”:“true”}’ -H “Content-Type: application/json” -X POST http://192.168.XX.XX:3000/assistant

curl: (7) Failed to connect to 192.168.XX.XX port 3000: Connection refused

I have changed the port to other values 3350 and 445 but didn’t work either. Any help would be much appreciated.


(Augustin) #1232

@icuc check this update


(Ram) #1233

Thanks @Augustin. I realized later and posted there as well.