Can a motion detector cause Google Home to play a sound?


(Craig Bennett) #1

I’m wanting to put a motion detector at my front door. I found out today the doorbell button isn’t sensitive enough, and instead of playing with that every so often and since I have Google home devices in many spots around my house.
Is it possible for Google Home to play a door bell sound if a given motion sensor detects motion?


(Graeme) #2

Yes, but you’ll need to set it all up - Here is a suggested method for doing this:

First, install cast-web: [RELEASE] cast-web 0.2 - Chromecast Device Handler & SmartApps
You’ll have to follow the instructions https://vervallsweg.github.io/smartthings/ to get it running - note the Prerequisites, as you will need a computer/device to run the node.js. This will add your Google Home Speakers as Things.

Once you have the speakers there, they behave the same way as Sonos speakers. You can then use the SmartApp called “Speaker Companion” which is in the Marketplace under SmartApps --> Music & Sounds. This allows you to play one of the preset sounds, or a custom message on a specific speaker when some event happens such as Motion, a switch is changed, Contacts are opened or closed, etc.

You can also use WebCoRE to do more complex actions.

HTH


(Craig Bennett) #3

Thanks for the heads up. I will take a look at it.
I tried the following method, but it turned out Google “broke” their SDK and I can’t simply use the broadcast feature. If they get it working again, then the following would be much easier in the long run


(Graeme) #4

Yes - I had that Assistant Relay working on my system before it got “broken” I switched to using the cast-web method I mentioned above and think I prefer it now. Both methods have plusses and minuses and are similar in requirements and effort to configure and get working. The main advantage I found with the cast-web method though is that once the GH speakers are added as things, you can do a lot more with them, including using existing SmartApps and WebCoRE pistons. Also, the Cast can cast the message or sound to a specific speaker whereas the Google Assistant relay used a Broadcast to all speakers.

As an example, I use it to remind people who close my patio doors to lock them as people often forget to do so after closing them. With the Assistant Relay, this message would broadcast throughout the house on all the GH speakers, annoying people in other rooms. With Cast-web, I direct the message specifically to the speaker near the door.
I also run a piston that sets the volumes on all the speakers to a preferred level so that after someone has been using one to play music loudly, the next person to ask Google a question is not shouted at by Google.


(Graeme) #5

Another pretty cool suggestion is to use IFTTT to take questions to Google and then direct them to WebCoRE where you can use the web-cast to respond. For example, I ask Google: “Hey Google, Check the Doors and Windows” before I leave the house. IFTTT sends that query to WebCoRE which then checks the contact sensors on my doors and windows and then Casts back to any speakers in rooms where the motion sensor is active, either “All Doors and Windows are Closed” or “The Following Doors and Windows are Open” followed by a list of all the open doors and windows.
Caveat: Unfortunately, at the moment, the responses to the TTS messages are spoken in the default voice, which has a US accent. As I am in the UK, my Google Assistant speaks with a British accent, so it does sound a little odd, but on the whole it works well. I did read that the author of cast-web is working on a new version that will have more functionality, including control over the voice used, so we’ll see how that works when it is released.


(Craig Bennett) #6

So I was working on this method, and I ran into a problem.


(Graeme) #7

Hi, I saw you got a response in the web-cast topic. Hopefully you have it working now.


(Craig Bennett) #8

:smiley: I was just testing it out. I’m going to make a video on this because how much of a pain it was, but put this in your system

http://192.168.86.41:3000/setMediaPlayback?address=192.168.86.9&mediaType=audio/mp3&mediaUrl=http://techreviewsandhelp.com/wp-content/uploads/2018/06/Someone-is-at-the-front-door-1.mp3&mediaStreamType=NONE&mediaTitle={mediaTitle}&mediaSubtitle={mediaSubtitle}&mediaImageUrl={mediaImageUrl}

obviously change the IP address to whatever needed

Now I just need to figure out how to get my motion detector to activate this


(Graeme) #9

If you have webcore that should be easy enough.
Alternatively, have you looked at the Smartapp called £Speaker Companion? You can get it to say whatever you want it to say when the motion sensor is triggered.


(Craig Bennett) #10

I wasn’t able to get the SmartThings hub to see the Google devices. I ended up doing a backwards method of having IFTT see if a motion sensor went off and then send a link to the house which told my computer to make the sound from that link.
I notice there is a good 10 to 20 sec delay. But since I’m just aiming for using this more than less as a doorbell since the delivery people refuse to use the actual button. I figure if I put the motion detector in the right place, then it should take them most of the delay for the speakers to say someone is at the front door.
Like I would love for everything to be local and not require the internet, and I will look into that. (Do you think Webcore will help with this?)

I’m moving within a year more or less, and I’m thinking of just using a ring doorbell if I can hook it up to my security camera system (ispy) and I could communicate to it without a subscription. From my understanding the motion detector works with this, and I could use it to tell the person whatever.


(Graeme) #11

Everything on SmartThings is done via the Internet, including WebCoRE and even basic functionality. WebCoRE gives you more flexibility and control in customising things.


(Craig Bennett) #12

Is going with WebCoRE faster than IFTTT?

If it isn’t, then what I have is good enough

BTW this is what I was able to come up with https://www.youtube.com/watch?v=WYdvZVI7KFA


(Graeme) #13

WebCoRE would definitely be faster than IFTTT. I use it for a number of my routines. For example, to turn on a light when motion is detected in a room after sunset, or when it is dark (measured from a lux sensor). I also use it to turn on bathroom extractor fans if the humidity in the room increases above a certain level. In these cases, there is a delay of no more than a second between the triggering event and the action taking place.

I use WebCoRE in conjuction with IFTTT as mentioned in an earlier post to have Google respond back to a query on whether doors or windows are open, and there is a noticeable delay there, but I don’t mind it in that case.

WebCoRE does take a bit of effort to learn and you would benefit from some programming experience if you want anything complex. There is a WebCoRE forum and Wiki (https://wiki.webcore.co/) to help with this. I am no expert, but I manage to bumble through and have achieved some useful things. The main reason I use it is because you can create, even fairly complex routines, relatively quickly, and can fine tune and tweak them to suit. There are also a number of good examples available in the forum that you can use as a base for doing what you want.


(Craig Bennett) #14

When you said everything on SmartThings is done by the net. I guess in Webcore the apps/activities is call pistons. Are they locally?

If so, what I’m thinking is of seeing if I can get that to just do the same functionality as I have now (play a MP3 on all the speakers when a motion sensor picks up someone), but I would have the MP3 locally. That away I can avoid going on the net with it, which in theory should give me the fastest speed as possible. Right now I’m hitting a good 15 to 20 second delay.


(Graeme) #15

All WebCoRE actions use Pistons to execute. As I understand it, the WebCoRE pistons execute on the SmartThings Cloud resources.
WebCoRE is tightly woven with ST and cannot be run without ST. All the ST actions also run online - you can see this from the IDE, where if you go to the Devices list, they will almost all show as “Cloud” for the Execution location (likely, including your motion sensor). You can probably store the file locally, but I am not sure if that would be of benefit. Most of your delay is probably due to IFTTT, and perhaps some time for loading and decoding the MP3 file. I use TTS (Text to Speech) for my verbal notifications from Google as they tend to be pretty quick. Perhaps you could try just having the bell sound as a file and then use TTS for the verbal part?

If you have managed to get your GH speakers to show as Things’ in ST, then definitely try the SmartApp I recommended before to see how quickly that executes.


(Craig Bennett) #16

I poked around at it and got the GH devices to show. I played around with the smart apps that is there, and my problem with them is the sounds don’t really tell you what’s going on. I’m about to put a sensor on my garage car doors so the device will tell me if it’s open, and maybe it will send a reminder to everyone if it stays open for too long (like someone forgot to close it).

Any case, it sounds like I won’t be able to get around from using the net. Thanks for the heads up


(Tanya Sawrie) #17

@zimguy can you share your piston for the door announcement? I have everything set up but stuck on how to do the piston


(Graeme) #18

Sure I presume you are referring to my previous comments of where I can say “Hey Google, Check Doors and Windows” and Google responds with something like “The Bathroom Window and Patio Sliding Door are Currently open”.

This assumes that you have set up the cast-web Chromecast Device Handler & SmartApps and have discovered your GH speakers and groups.

It requires you set up an Applet in IFTTT with Google Assistant as the trigger/This and Webhooks as the Target/That. I set my Applet as “Say a phrase with a text ingredient” and set the phrase (and optional alternatives) as:

  • Are any $ open?
  • Check the $
  • which $ are open?

and I set the Assistant response to “Sure, I’ll check your $”

The $ will be where I can say “Doors” or “Windows” or “Doors and Windows”. You can use shortcuts in the Google Home app to set other ways of saying the same thing.

For the Web Request, I got the URL from WebCoRE (which WebCoRE provides when you create a new condition using the IFTTT virtual device) and I set that as the URL with TextField after it: like this:

In WebCoRE, I have 3 Global variables which I use in various pistons called @Downstairs_Windows, @Upstairs_Windows and @Entry_Doors. They are device variables and contain a list of all the appropriate door/windows open/close sensors.
Here is the piston:

The first bit, checks various motion sensors and then selects a speaker to use to respond based on there being motion in that room in the last 2 seconds. I have 3 speakers and get Google to respond only where there is motion. If it gets through the 3 if statements and the variable {speaker} is set to {$location} then it sets the speaker to the speaker group that contains all speakers. You can skip all that and just set the speaker variable as your speaker or group of choice if you prefer.
I then have the 3 possible requests I can make using the text ingredient in IFTTT, “windows”, “doors” or “doors or windows” (and variations of the latter). Then the responses are provided using Speak Text and Restore.

It all works pretty well and is useful for making sure everything is closed before leaving the house without having to go and check everything. HTH


(Tanya Sawrie) #19

That is awesome! I’ll have to dig into this. I was actually referring to the patio door reminder. But this one is incredible!


(Graeme) #20

Ah - ok, I originally used this piston to do that:

The Minutes Between Warnings prevents it from going off too often. The Contact Sensor is the one on the Patio door and the speaker is the GH speaker in the living room near the door.

Instead of using WebCoRE for this though, you can achieve the same thing using the BigTalker 2 SmartApp. I switched to using BigTalker2 for that simply because it is easy to use and configure from a phone, unlike WebCoRE IMHO.