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

Thanks @Danabw I followed this https://medium.freecodecamp.org/building-a-node-js-application-on-android-part-1-termux-vim-and-node-js-dfa90c28958f but I’m still none the wiser about how to get google assistant relay on it.

I’m totally new to node.js and despite some reading am not sure what to do next :S

Any chance you might help?

I am a noob as well…no experience w/node.js and Android. I’m running this on a Raspberry Pi set up via the blood, sweat, and posts of others here. :slight_smile: I’d suggest that if you have about $40 to $50 free you could pick up a Raspberry Pi (more likely to be able to use info here to get things set up), or run on a Windows machine if you have one that’s on all the time. No one’s been talking about doing this on an Android device so far.


I have downloaded the repo and managed to get a terminal interface within terminux but not sure where/how to ’ use npm install to get started’ as stated in the readme.

Hopefully someone w/more experience will help you…I stumbled through my install/setup with tons of “doh!” questions here, and this was on a Pi, so some of the steps were pi-specific AFAIK. Sorry I can’t do more at this point.

Once youve installed node, you will probably need to add node-ssdp (install by typing npm install node-ssdp). After that I changed the port and got stuck myself as I havent had time to debug what is going on. This is the error that is returned by the Post request:

<!DOCTYPE html>
<html lang="en">
        <meta charset="utf-8">
        <pre>Error: Callback was already called.
            <br> &nbsp; &nbsp;at /home/pi/assistant-relay/node_modules/async/dist/async.js:955:32
            <br> &nbsp; &nbsp;at GoogleAssistant.assistant.on (/home/pi/assistant-relay/index.js:199:12)
            <br> &nbsp; &nbsp;at GoogleAssistant.emit (events.js:160:13)
            <br> &nbsp; &nbsp;at GoogleAssistant.start (/home/pi/assistant-relay/node_modules/google-assistant/index.js:32:12)
            <br> &nbsp; &nbsp;at sendTextInput (/home/pi/assistant-relay/index.js:189:13)
            <br> &nbsp; &nbsp;at /home/pi/assistant-relay/index.js:56:3
            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/home/pi/assistant-relay/node_modules/express/lib/router/layer.js:95:5)
            <br> &nbsp; &nbsp;at next (/home/pi/assistant-relay/node_modules/express/lib/router/route.js:137:13)
            <br> &nbsp; &nbsp;at Route.dispatch (/home/pi/assistant-relay/node_modules/express/lib/router/route.js:112:3)
            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/home/pi/assistant-relay/node_modules/express/lib/router/layer.js:95:5)
            <br> &nbsp; &nbsp;at /home/pi/assistant-relay/node_modules/express/lib/router/index.js:281:22
            <br> &nbsp; &nbsp;at Function.process_params (/home/pi/assistant-relay/node_modules/express/lib/router/index.js:335:12)
            <br> &nbsp; &nbsp;at next (/home/pi/assistant-relay/node_modules/express/lib/router/index.js:275:10)
            <br> &nbsp; &nbsp;at serveStatic (/home/pi/assistant-relay/node_modules/serve-static/index.js:75:16)
            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/home/pi/assistant-relay/node_modules/express/lib/router/layer.js:95:5)
            <br> &nbsp; &nbsp;at trim_prefix (/home/pi/assistant-relay/node_modules/express/lib/router/index.js:317:13)

Just in case…

1 Like

Ok, all working properly now, I just hadnt copied the confirmation code into the SSH window properly as the error messages seemed to stop the pasting of the code correctly.

For anybody else interested in setting this up on a Raspberry Pi, in order to get the script to run automatically when booting, then use the code below as this was the only way I could get it to wait for all dependent scripts/modules/…)

Add the text below to rc.local by running a command like sudo nano /etc/rc.local and the text that should be added is (add it just before the exit 0 line).

(sleep 60
node /home/pi/assistant/index.js &> /home/pi/assistant/assistant-reboot.log) &

FYI: This will delay the start of the script until 60s after rc.local is run, which is about 30s after the Pi has finished booting (and mine is already starting quite a few other processes at boot). You will need to change directories as required.
FYI2: If you want to change the port, then it is indeed possible to change the port number in index.js. Just do a find/replace and you need to change all occurrences of 3000 to your new port (I picked 4000 as there seem to be far fewer programs that use that port). There are three occurrences that need replacing (well two need replacing, but there are three occurrences so best do all of them).

Yikes! Thanks for the heads up!


@ghesp Just wanted to say a proper thank you for this! Have had so much fun setting things up with this today!

Node.js was a useful learning on my Raspi, and now every time my OH turns on the sitting room lights I have Google Home make a comment about me being right, makes a nice change! Cant wait for her reaction! :slight_smile:

1 Like

That’s what I call an effective use of technology. :slight_smile: You can up the ante further…

I have energy monitoring on my washer/dryer, and use the relay to play funny (to me, anyway!) reminders for my family to get their laundry from the washer to the dryer when the washer finishes, and then out of the dryer when it’s done. We have GHs in the family room and office, so the message gets to us in our two most frequently used rooms, and it actually works so far. Now I rarely run into a washer or dryer full of someone else’s clothes when I go to do my own laundry.

I am having the same issue discovery as someone earlier, the GH announced when the server came online but the SmartApp cannot discover it. It is running on a win10 box with firewall disabled for testing. I am able to sent post commands that work and announce on GH using “curl -X POST” from my ubuntu server via putty, command also works from the bash shell in Windows after I installed it.

Is there a way to hard code the IP somewhere? Or has anyone else had this discovery issue?

Man this is an awesome app…I am so close!

Look up the Postman app - should be available for pretty much any platform, you can use it to send POST commands.

You can also send them via webCore, but if you haven’t set that up yet, using Postman is a lot easier.

Also - make sure you don’t have anything else competing for the port. That has affected a couple users.

1 Like

Thank you…I was able to post them from my ubuntu server via putty, but I hope that helps someone else. I still cannot discove the server from the app.

It never finds it at all?

Did you see this? Solved his discovery problem.

1 Like

No, it says “Starting Discover” and the little hamster wheel just spins and spins. I changed the IP of the server to a lower IP thinking that the discovery does an IP sweep starting at the beginning of the subnet, have restarted everything

I use “Untangle” as my router, I will look for IGMP settings now, thanks

looks like Untangle is screwing me. So either i need to hard code it or I will investigate “WebCore to send a POST request to the IP address of the relay manually” as I have Core running…but no idea where to add this.

So according to Untangle they do not support IGMP. I have a Ubiquiti switch at the core of my network that does support it but changing it made no difference. I dont really understand IGMP but it does not seem like that would be the issue from what I read. Does the app, as part of its discovery just do a ping sweep of the current network looking for IPs the respond and then check for a response on port 3000? Is there not a way to set the IP of my node server in the code itself? Also, I cannot figure out for the life of me how to get webcore to create an item that I can send messages to given that I cant get the device to be discovered. so if anyone who has made WebCore work with the relay service node WTHOUT needing to use the smartapp or device handler on the ST app could pointy me in the right direction I would appreciate it.

I will make a feature request to be able to add the IP manually either in the code or in the ST App GUI. Regardless, this project and the hard work are greatly appreciated!

For anybody wondering, or struggling with the discovery process, you can ignore it if you set up the device correctly in ST. As an outline, the steps to do this are as follows:

  1. Install the device handler by pasting as code into the IDE
  2. Go to the Devices section of the IDE and create a device for Google Home Assistant, following this pattern that I used:
    Note that your Device Network ID should be as follows: IP:Port in HEX, hence mine is which translates to C0A80102:0FA0 - you will likely need to change the 0102 section at the end to the correct IP, and you are probably using port 3000 (default) which means then ending should be :0BB8 rather than :0FA0
  3. You can now send a test command through CoRE/WebCore and everything should be working, without needing the discovery SmartApp.


Thank you! The above worked like a charm, just like the rest of this project! I really appreciate you taking the time to create this project, it is so needed!