SmartThings Community

[RELEASE] Google Assistant Relay SmartApp and Device Handler

devicetype
smartapp
requires_server
googleassistant
googlehome

(brayton) #1

Google Assistant Relay SmartApp and Speech Device Handler

for use with Google Assistant Relay v2

Important: The smartapp and device handler will only work with a functioning Google Assistant Relay v2 server. For information on the Google Assistant Relay visit the Google Assistant Relay v2 SmartThing’s forum post.

SmartApp: Used to broadcast SmartThings device state changes to your Google Home using the Google Assistant Relay v2. The smartapp listens for smartthings device events and POST’s a JSON message to the Google Assistant Relay v2 server when a device event is triggered.

Device Handler: Can be used in conjunction with 3rd party tools (ie. WebCoRE) to send custom notifications to your Google Assistant Relay v2 server.

You do not need to install both the smartapp and device handler. If you only want device notifications the smartapp will do that autonomous from the device handler. The device handler is handy to have if you are integrating other smartapps or 3rd party applications that need a smartthings device to perform an action. Currently the device handler only supports the speech synthesis capability.

Source

Install Instructions: Installing the SmartApp on the SmartThings hub and in the SmartThings App

STEP 1: Install the SmartApp on the Hub

Method 1

Login to your SmartThings API account
https://account.smartthings.com/

Click My SmartApps

Click Settings

Click Add new repository and fill in the fields with these exact values and click Save:
Owner: braytonstafford
Name: google-assistant-relay
Branch: master

Click Update from Repo and select google-assistant-relay (master)

In the right side panel under New (only in GitHub) check the box next to smartapps/braytonstafford/google-assistant-relay-notifications.src/google-assistant-relay-notifications.groovy

Check the box for Publish

Click Execute update

Method 2

Login to your SmartThings API account
https://account.smartthings.com/

Click My SmartApps

Click New SmartApp

Click From Code

Copy and Paste the code from here into the code editor

Click Create

Click Publish -> For Me

STEP 2: Setup the SmartThings Mobile App

Open the SmartThings App

Go to the Marketplace

Click SmartApps

Click My Apps

Click Google Assistant Relay

Choose the devices you want to receive notifications when their state changes.

Fill in the Google Assistant Relay Hostname or IP Address

Fill in the Google Assistant Relay Port

Click Save

You should now hear broadcasts to your Google Home when the selected devices’ state changes.

Install Instructions: Installing the Device Handler on the SmartThings hub

STEP 1: Install the Device Handler on the Hub

Method 1

Login to your SmartThings API account
https://account.smartthings.com/

Click My My Device Handlers

Click Settings

Click Add new repository and fill in the fields with these exact values and click Save:
Owner: braytonstafford
Name: google-assistant-relay
Branch: master

Click Update from Repo and select google-assistant-relay (master)

In the right side panel under New (only in GitHub) check the box next to smartapps/braytonstafford/google-assistant-relay-speech.src/google-assistant-relay-speech.groovy

Check the box for Publish

Click Execute update

Method 2

Login to your SmartThings API account
https://account.smartthings.com/

Click My Device Handlers

Click Create New Device Handler

Click From Code

Copy and Paste the code from here into the code editor

Click Create

Click Publish -> For Me

STEP 2: Create the Device on the Hub

Login to your SmartThings API account
https://account.smartthings.com/

Click My Devices

Click New Device

Enter these values in the fields and click Create:

  • Name: Google Assistant Relay Speech
  • Label: Google Assistant Relay Speech
  • Device Network Id: GoogleAssistantRelaySpeech1
  • Type: Google Assistant Relay Speech
  • Version: Published
  • Location: [YOUR LOCATION]
  • Hub: [YOUR HUB]
  • Group: Location: [YOUR GROUP] (if applicable)

STEP 3: Setup the Device in the SmartThings app

Open the SmartThings App

Go to My Home

Under the Things tab click the Google Assistant Relay Speech device

Click the settings wheel in the top right

Enter the Google Assistant Relay Hostname/IP Address and Port

Click Save

Your device is now setup in the SmartThings app. This device has the speech synthesis capability which can be used with WebCoRE to send custom phrases to your Google Assistant Relay


Google Home + SmartThings = Announcer for doors, motion, and everything else, I hope
[Release] Google Assistant Relay V2.0 - Google Home Audio Notifications!
Using Google Home (assistant) speaker for notifications/alarms?
Google assistant - "BROADCAST" command as TTS
(Eric) #2

I could not get it to save anything except a button press. If I tried anything else it would give me an error on save.


(brayton) #3

@ehupp01 I was able to recreate the issue you were experiencing and I’ve made an update to the code if you would be willing to reinstall with the same instructions this issue should be resolved.

brayton


(Eric) #4

Ok I will give it a shot tomorrow and post back.


[Release] Google Assistant Relay V2.0 - Google Home Audio Notifications!
(Eric) #5

That has it working now. Great Job!!


(Ram) #6

Great work. I have the Greg’s assistant replay setup and I will play around with this one as well.


(Joe Lawson) #7

Can this relay be added to Webcore? I’m not able to find it listed. Do you have a device handler with this release for Smartthings?


(Salman Mehdi) #8

Awesome, Thanks brayton. This id working great.
Thanks again for making it so simple to integrate relay with smartthings.


(brayton) #9

This smartapp works in conjunction with the Google Assistant Relay v2 created by @ghesp.

To use this you would need to have the Google Assistant Relay v2 up and running first and then when you install this smartapp it will ask for your Google Assistant Relay v2 server IP/Hostname and port.


(Joe Lawson) #10

Yeah I was able to get it running. In the version 1 I had a smartapp as well as a device handler installed which allowed me to choose assistant relay in web core and initiate personalized voice alerts based on different states. I’m not able to find the DH now and I uninstalled in some troubleshooting efforts to get it back up and running. Thanks for your work on this one.


(Joe Lawson) #11

Anyone have the code or know where to find it?


(brayton) #12

tbh I didnt find a smartapp or device handler for the google assistant relay v2 and I didnt even check for v1 however I just installed webcore to check it out and am working to create a device handler for v2. I’ll report back when I’ve got some progress.

If you do happen across the device handler you were using and dont mind linking it here it would be much appreciated.


(Joe Lawson) #13

@brayton That’s awesome I appreciate. I will certainly link it back here but I have been searching all over and not able to find a thing as of yet. I was hoping I had it on my server but so far not found anything their either. I never thought twice when I deleted it from smartthings as I figured I would be able to find it easily enough.


(brayton) #14

Well the device handler wasn’t too tough to put together and I’ve added that into the github repo (install instructions have been updated too). I installed webcore and setup a piston to Speak a message to the device I created with the device handler and its broadcasting to my Google Homes!!

Let me know if you run into any snags

image


(Joe Lawson) #15

@brayton Thank you so much sir. I got it installed and showing up in webcore now not sure I will have time to play around with it before I head out to work. I did want to mention to install the device handler I had to go incognito on my browser. Got the stupid permissions issue prior in the IDE. Also I had to clear cache in Webcore before it showed up as a device. Just wanted to mention that for anyone else that may run into the same issues. This is awesome man thank you so much sir!


(Joe Lawson) #16

I tried to implement a new piston and was not able to get google to announce. Any suggestions? I have a sense device and have integrated it into SmartThings. So I wanted the home to announce when the dryer is done. I’m, not an expert with Webcore and they recently upgraded webcore which has caused me to be even more confused. With the version 1 relay and device handler I had several custom announcements setup and working with no issues. It may be the way I have it setup in Webcore but wanted to see if anyone here can provide guidance?


(Joe Lawson) #17

I noticed you was using speak instead of custom broadcast I have updated the piston with this option. I will not be able to test until I get home from work though.


(Joe Lawson) #18

I’m not sure if it is working still but I did realize I did not have any checks and balances in my piston so I added only after the dryer has been on for 1 minute should it announce. I would hate to have it announcing constantly we all know that would not pass the wife test. Just wanted to share in case anyone else is trying to accomplish something similar and also if my piston is crap they can let me know.


(Johnnie Pattison) #19

I set this up today in the hopes that it would get rid of the annoying “broadcast from [username]”. It does not. makes my webcore statements a lot cleaner though. Thanks


(brayton) #20

yeah i think we are all getting that as of now. I’m taking it as a sign they are working on the broadcast replies but at the same time I’m hoping Google disables it soon.