[NEEDS UPDATING] Google Assistant Relay SmartApp and Device Handler

How can i broadcast to a “group” ?

Would this https://www.instructables.com/id/Create-Custom-Actions-for-Google-Assistant/ work to get rid of the “Broadcasting from” ?

I agree with you. It is worth a try cause the 'broadcasting ’ seemed really deliberate and completely broke immersion and it was driving me so nuts that I disabled my pi and even bought a sonos because I got so used to just getting simple notifications until Google ruined it.
However I doubt you can incorporate this into webcore unless a new device handler is made

I switched from Ver. 1 to 2 and used a different computer for this - I turned off the other computer that was running the ver. 1. The relay seems to be running with no issues but I’m unable to discover it in the Smartthings app for some reason - I give it more than 10 minutes to search with no success - any idea why? I did remove the old ver. 1 relay before started the discovery

I’m a novice and trying to understand what the difference between this and the Google Assistant Relay is. I have both installed but not able to get the Google Home Speakers to show up in Webcore. My understanding is this or the Google Assistant Relay make the Google Home speakers show up as a speaker device in the ST app. “Cast-web-api” shows up as an audio player for audio notifications but that was showing up when I installed the Google Assistant Relay so what does this app do?

The Google Assistant Relay is a program written in Node.js that runs on a computer/raspberry pi. It waits for requests to be sent to it and when it receives a request it authenticates to your google account and uses the google assistant API to connect to your Google Home and play a notification.

The Google Assistant Relay SmartApp and Device Handler is the SmartApp inside the SmartThings mobile app that allows you to configure the IP and port that your Google Assistant Relay server is running on and then pick the SmartThings sensors that will trigger the Google Assistant Relay to broadcast a notification to your Google Home.

1 Like

This has become one of the most handy smartapps over the past few months, thanks!

I have a few instances of the smartapp running for different things at different times. The most useful is “motion on front porch” notifications from the Google Home in our kitchen, mostly for package deliveries).

The problem is my old front porch Monoprice motion sensor is subject to many false alarms for about an hour every day on sunny mornings when the sun or shadows hit at just the right angle. So I added just a few lines of code to easily exclude notification relays at certain times.

Just sharing in case it helps someone else:
Add a new input section/line 48

section("Turn on between what times?") {
    input "fromTime", "time", title: "From", required: false
    input "toTime", "time", title: "To", required: false
}

Updated relevant device handler, motion in this case

def motionHandler(evt) {
def between = timeOfDayIsBetween(fromTime, toTime, new Date(), location.timeZone)
if (between) {
relayMessage(“Motion detected at ${evt.getDevice()}”, evt)
} else {
}
}

In the mobile app

1 Like

Thank you for the compliment @Dlee

I have been meaning to add some type of scheduling ability and your post was the motivation I needed. I’ve updated the smartapp and added in the ability to schedule when notifications are sent using your example.

Currently a notification schedule can be enabled by device type.

If the schedule is not enabled:

  • A notification will be sent

If the schedule is enabled:

  • A notification will only be sent if your current local time falls between the configured From and To times.

I’ve also added an optional field to specify the username that is configured for authentication in the Google Assistant Relay server.

1 Like

Synced to your latest github repo change and tested your fantastic enhancement. It looks good, easy to understand for me, and functions fine.

I found one ST UI quirk issue (on Android app). If you add any new device like Smoke sensors in the homePage main app page and then do not open and save the new scheduledPage, your only option is to back out of the main page and the app prompts user to continue and lose the unsaved changes yes/no. User has to figure out they need to go to Schedule Notifications page and press Save, even if they didn’t make any notification changes. It seems a Save button on homePage is expected.

I’ve not played with dynamic pages before, but adding install=true to homePage seems give the Save button I expected, and it works.

dynamicPage(name: “homePage”, title: “Google Assistance Relay Notification Setup”, install: true, uninstall: true) {

Multiple pages changes defaults as explained here. I learn something new every day.

:smile: I overlooked that option, thanks for testing it out. I’ve added this fix into my repo.

You seem to be pretty experienced in the classic docs. Have you experimented with the new developer portal stuff?

Not really. That ST classic link is what popped up when I searched for dev docs on dynamicPage.

I’m usually just tweaking around when I visit here and have not dug very far into any ST development in a few years. It’s a love/hate relationship with ST. :slight_smile: All the more reason to appreciate what you did pulling all those Google Assistant pieces together. It’s never failed running on an RPI for months now.

When I add a cast-web-api device (google home mini) to my SmartThings, within “Things”, it shows presets that I can set for each device, but I can’t figure out how to associate the preset buttons with anything. Does anybody know how to do this? The devices work great for casting alerts (ex: they tell me when my toddler opens her bedroom door at night) … but if I can set the presets, that opens a whole world of possibilities for me!

I do not still understand what is purpose of this smartapp and device handler.

@brayton answered earlier:

"The Google Assistant Relay is a program written in Node.js that runs on a computer/raspberry pi. It waits for requests to be sent to it and when it receives a request it authenticates to your google account and uses the google assistant API to connect to your Google Home and play a notification.

The Google Assistant Relay SmartApp and Device Handler is the SmartApp inside the SmartThings mobile app that allows you to configure the IP and port that your Google Assistant Relay server is running on and then pick the SmartThings sensors that will trigger the Google Assistant Relay to broadcast a notification to your Google Home."

I’m stupid or maybe it’s because english is not my native language… or most likely both… but did I got this right.
Installing this smartapp and device handler I can use alternative method for broadcasting notifications. For example I do not have to use webcore for notifications anymore cause they can be send through smartapp?

About device handler. As I’m looking @Bryan_Mack latest post there is pictures where google home mini is one of the smartthings devices on the list. Is it possible to control google home mini via smartthings like Alexa virtual device is built? There’s possibility to see latest voice commands or what song is casting, change volume, pause music etc. ?

Hello brayton,
Thank you for your post. I am having trouble to figure the IP address and port for google assistant relay. Where can I find them?

Best regards,
Brian

1 Like

Does this work with v3 of Assistant Relay? I can’t seem to get it working, whereas I was able to get assistant relay working with webcore.

Also, using the device handler, what is the difference between the speak command and the send device notification within webcore?

Hello, Can somebody guide how to code the random messages to be broadcasted? I tried with random keyword like in earlier posts. But not working.

I got it.

{random(“Water is hot enough to take a shower. Just a reminder to turn it OFF”, “Water Heater is ON for 5 minutes. Please turn it OFF.”, “Hello, somebody there? Its time to take shower and dont forget to turn OFF the heater.”)}

I was wrong. After testing for few hrs, I realized its picking same message all the time. Can somebody shed some light?

1 Like

any luck on this. also does anyone know if sonos does random messages