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

Thanks - wasn’t aware of that capability - very cool.

Confirms that the custom command isn’t getting to the relay - when I run a piston w/only a custom command nothing appears in the log, when I run a piston w/a custom command and a custom broadcast, only the broadcast appears. So seems likely I’ve missed something when I updated from the github.

When I updated assistant relay on my Pi, I downloaded the updated zip for the Assistant Relay from Greg’s github, unzipped and then copied over my assistant relay folders (replacing any existing files except for config.json).

01%20AM

For poops and giggles, stop your relay instance, run an npm install within the assistant-relay-master folder and restart your instance.

pm2 stop 0
npm install //from within your assistant folder
pm2 start 0

Got a bunch of erros on the npm install:

i@raspberrypi:~ $ cd assistant-relay-master
pi@raspberrypi:~/assistant-relay-master $ npm install

> 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 (/opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:160:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.9.59-v7+
gyp ERR! command "/opt/nodejs/bin/node" "/opt/nodejs/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 v9.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN assistant-relay@0.0.2 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 4 packages in 18.451s

Expected? Or re-run w/sudo?

I restarted the relay using the normal command I’ve been using and see this below…I assume I don’t need to worry about the two instances listed (assistant relay and “assistant relay”).

pi@raspberrypi:~/assistant-relay-master $ pm2 start index.js --name=“assistant_relay”
[PM2] Starting /home/pi/assistant-relay-master/index.js in fork_mode (1 instance)
[PM2] Done.
┌───────────────────┬──────┬─────────┬───┬─────┬───────────┐
│ Name              │ mode │ status  │ ↺ │ cpu │ memory    │
├───────────────────┼──────┼─────────┼───┼─────┼───────────┤
│ assistant_relay   │ fork │ stopped │ 0 │ 0%  │ 0 B       │
│ “assistant_relay” │ fork │ online  │ 0 │ 74% │ 15.5 MB   │
└───────────────────┴──────┴─────────┴───┴─────┴───────────┘
 Use `pm2 show <id|name>` to get more details about an app
pi@raspberrypi:~/assistant-relay-master $ 

I got the same errors as you did if it makes you feel any better. :smiley:

Alright - I got it all setup and it’s working great via curl -X POST method. I’m going to attempt to make a piston that utilizes it.

Thanks for the awesome work - this is really damn cool. https://youtu.be/Gp9fjbHgPtg

I cannot specify presets, it keeps saying “User not found. Who is undefined?” despite me specifying matt as the user.

You shouldn’t need to specify an owner when sending custom broadcasts using the DTH from webCore pistons. Don’t add an owner and just select the customBroadcast option and a single String parameter from the Parameters drop-down.

35%20PM

And your config.json file should contain your user identification info:

{
  "users" : {
    "danabw": "client_secret_xxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
  },
  "language": "en-US"
}

Presets you need to send the user in your config file as a 2nd param

Like this, correct? If so, nothing outputs then from my speaker when I turn off the light. If I don’t include that 2nd param, I can watch in the PM2 dashboard saying the following:
assistant_relay > No user specified, using matt │
│ ││ assistant_relay > Conversation Complete
And it runs fine.

The “customCommand” command requires a second parameter with the user name.

For example: customCommand(‘what is the weather’, ‘mike’);

I installed postman, and it posts fine.
Any thoughts on what to check?

That’s how I have it setup, was I suppose to edit something in there as well?
I can copy/paste what’s in it, if that helps.

I’m still just getting “An unexpected error occurred” .
When I go into my smartthings app, Marketplace > SmartApps > My Apps. I see Assistant Relay, it finds my 1 device named “Assistant Relay fb5” (not sure what fb5 is from).

I tried it both ways, both with and without a user name and it doesn’t work either way for some reason. My relay never sees the command, so it’s getting lost between the piston and a relay somehow.

That all looks fine, no his ideas for you, unfortunately.

Trying to figure out why customcommand is failing, used Postman to send the following from my Chromebook, and pm2 monitor does see the request. Tested again from my piston and now pm2 also sees the request, but in both cases it errors out.

From Postman sent below (xx replaced by actual IP in command sent, and also sent the custom command from a piston using DTH/parameter selections. Note that like @Phred_Doolittle, I get an error on the name even though the name is accurate and in my config.json file.

http://192.168.1.xx:3000/custom?command=what is the weather&user=Danabw

Postman shows below when sent:

<pre>TypeError: Cannot read property &#39;start&#39; of undefined
            <br> &nbsp; &nbsp;at sendTextInput (/home/pi/assistant-relay-master/index.js:189:13)
            <br> &nbsp; &nbsp;at /home/pi/assistant-relay-master/index.js:48:3
            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/home/pi/assistant-relay-master/node_modules/express/lib/router/layer.js:95:5)
            <br> &nbsp; &nbsp;at next (/home/pi/assistant-relay-master/node_modules/express/lib/router/route.js:137:13)
            <br> &nbsp; &nbsp;at Route.dispatch (/home/pi/assistant-relay-master/node_modules/express/lib/router/route.js:112:3)
            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/home/pi/assistant-relay-master/node_modules/express/lib/router/layer.js:95:5)
            <br> &nbsp; &nbsp;at /home/pi/assistant-relay-master/node_modules/express/lib/router/index.js:281:22
            <br> &nbsp; &nbsp;at Function.process_params (/home/pi/assistant-relay-master/node_modules/express/lib/router/index.js:335:12)
            <br> &nbsp; &nbsp;at next (/home/pi/assistant-relay-master/node_modules/express/lib/router/index.js:275:10)
            <br> &nbsp; &nbsp;at serveStatic (/home/pi/assistant-relay-master/node_modules/serve-static/index.js:75:16)
            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/home/pi/assistant-relay-master/node_modules/express/lib/router/layer.js:95:5)
            <br> &nbsp; &nbsp;at trim_prefix (/home/pi/assistant-relay-master/node_modules/express/lib/router/index.js:317:13)
            <br> &nbsp; &nbsp;at /home/pi/assistant-relay-master/node_modules/express/lib/router/index.js:284:7
            <br> &nbsp; &nbsp;at Function.process_params (/home/pi/assistant-relay-master/node_modules/express/lib/router/index.js:335:12)
            <br> &nbsp; &nbsp;at next (/home/pi/assistant-relay-master/node_modules/express/lib/router/index.js:275:10)
            <br> &nbsp; &nbsp;at serveStatic (/home/pi/assistant-relay-master/node_modules/serve-static/index.js:75:16)
        

PM2 monitor shows a bunch of what looks like errors (in red?) but I cannot figure out how to copy the text from the log window in the pm2 monitor - highlighting via mouse doesn’t work, as the hightlight goes across the entire UI and doesn’t scroll the text down to select it.

I took a screen shot to show the first pm2 monitor screen of the response:

second cap w/the rest of the log results for custom command sent via postman:

PM2 monitor results (screen cap of first few lines) from piston sending custom command:

Second cap for the rest of the lines (w/some overlap):

Just VNC to it and take a snippet of it if all else fails.

Yeah, I am using VNC, and took a couple screen shots of the log content for the pm2 monitor result for the command sent from the piston.

Happy to try any suggestions. :slight_smile:

I ran a test with a custom piston to trigger what’s the weather if I turn on my office bloom and it fired. Here are the screens. Despite saying it triggered twice, I only heard it the weather forecast once on my googe home mini.

Capture1
Capture2

Bizarre…that’s exactly what I’m doing from my piston…I must have some missing piece or misplaced piece somewhere…

i’ve run this w/ an w/out the broadcast in case that mattered, and the custom command fails in both cases

14%20PM

Can you make Danabw all lowercase?

And it started fine via command? And lowercase your name just in case.

Capture3