READING TIME: 10 MINUTES
Have you ever wanted your Google Home devices to announce when a door was opened, doorbell was pressed, or if a leak was detected?
Let me answer that for you. Of course you have!
In this guide, I’m going to show you how to control Google Home devices with SmartThings to create verbal alerts when something happens. To do this, we will be installing the cast-web api & integrating it with WebCore.
Even if you’ve never programmed anything before (or used Webcore), you can literally follow my guide step-by-step to get this setup. I wanted to give a huge shoutout to The Bearded Tech Guy for his inspiration!
In order to set this up, you will need the following:
- Webcore installed using the Community Installer
- At least 1 Google Home speaker (Either Google Home Hub, Google Mini, or Google Nest Hub)
- Samsung SmartThings Hub
For this guide, I am installing it on Windows 10. There are also Windows, Linux, Mac, or Docker images available here: https://vervallsweg.github.io/cast-web/installation-cast-web-api/ The setup is basically the same no matter which option you choose.
Ideally, the device you choose should be on the same subnet as your SmartThings hub and stay on 24/7. If I were to do this setup again, I’d probably configure it on a raspberry pi, since my desktop PC gets rebooted much more frequently.
Step 1: Download & Install Cast-Web-Api for Windows
Download the Cast-Web-api from here: https://github.com/vervallsweg/cast-web-api-desktop/releases/tag/v1.2.1
Click the cast-web-api-desktop-setup-1.2.1.exe
After downloading, double-click the .exe to install it like you would any other program.
On the blue Windows SmartScreen popup, click More Info > Run Anyway. This is expected behavior as the app is not code-signed.
It will take a few minutes for the program to finish installing. Once it’s finished, it will launch the cast-web api window but state that it is offline.
Step 2: Download Node.JS
Download the Node.js Windows installer from here: https://nodejs.org/en/download/
Install it with all default settings.
Step 3: Add IP Address to Cast Web API Settings
Open Command Prompt and type this to find your computer’s IP address. You will need that IP address for Step 4.
Step 4: Add IP Address to Cast Web API Settings
Search your computer for cast-web-api-desktop. Once it launches, click the gear to access the settings.
Next, add your IP address to the settings of Cast Web API and save.
The app should now to connected. To confirm, go to 192.168.68.105:3000 in a web browser. It should load like this:
If you receive an error on this step, verify that:
1. Node.js is installed
2. Hostname has been changed from 188.8.131.52 to your computer’s IP address
3. Stop/Start and/or relaunch cast-web-api-desktop.
Step 4: Add 2 Device Handlers & 1 SmartApp
Open the Samsung SmartThings IDE: https://account.smartthings.com/
Device Handler 1: cast-web-device
Click My Device Handlers > Create New Device Handler > From Code tab. Copy & paste the code from here.
Click Publish > For Me. Then Save.
Device Handler 2: cast-web-api
Click My Device Handlers > Create New Device Handler > From Code tab. Copy & paste the code from here.
Publish > For Me. Then Save.
SmartApp 1: Cast-web service manager
Click My SmartApps > New SmartApp > From Code tab.
Copy & paste the smartapp code from here.
Do not save and publish just yet. You’ll need to edit 1 line of code.
Edit ApiHostAddress Line
Locate the line of code below. Replace the word “string” with “text“. This change is needed in order for it to work in the new SmartThings app.
input "apiHostAddress", "text", title: "API host address", required: true
Next, click Create > Publish > For Me.
And then save your changes. You should now see the cast-web service manager published.
Step5: Add SmartApp to Phone
Now that we’ve successfully installed cast-web api on Windows 10, and added the two required device handlers and smartApp, it’s time to add the SmartApp!
Grab your phone and open the new Samsung SmartThings app.
Click the hamburger menu on the left to open the menu > SmartApps.
Click the + sign to add a new smartapp. Scroll to the bottom and locate the cast web – service manager.
Click the app to open the settings.
Step 6: Edit SmartApp Settings
If the API host address field doesn’t show up at this step, verify that you’ve changed the line of code in Step 4. (Scroll up until you find the green box.)
Enter API Host Name & Test
Enter your API Host address info from Step 3. Make sure to include the port number 3000
Click Test API Connection to verify the connection works. If you see Connected OK:200, you can continue.
Change Service Manager Log Level
Change the Service Manager log level to 0 so you don’t get a bunch of unnecessary log files. (You’d only want to change this to 4 for troubleshooting.)
Step 6: Discover Devices
Click Discover Devices. It could take up to 5 minutes to discover all of your Google Home devices, so just sit back and relax.
Select all the Google Home devices you want to add to SmartThings. (You can also add speaker groups during this step.) Once you’ve added the devices, click Next. Then, click Done to return to main SmartApps page.
Step 7: Change Device Names
On the SmartThings Home Screen, you’ll see a bunch of new devices + the Cast-Web api. You’ll notice they all have the same name which makes it hard to identify which device is which.
Wait a few minutes to see if they populate the room info automatically. (I waited about 15 minutes but they didn’t autopopulate for me.)
If you don’t want to wait, simply click a device and drag the slider volume up or down. You’ll hear the audible “volume click” sound.
The easiest way to do this for all your devices is to stand next to one of your Google speaker devices and scroll the volume up from the app. If you hear the volume click, you’ve found the correct device! Keep changing volumes on the different cast-web-api devices from the SmartThings home screen until you have them all labeled.
Then just edit their name manually.
Step 8: Install Webcore
For the rest of this guide, we are going to be using Webcore to create some simple automation rules for things such as “If front door opens, then speak a message aloud”.
Note: You can also use other rule engines such as SharpTools if you’d like.
If you’ve already installed Webcore, you can skip to Step 9.
If you haven’t, I recommend following the community installer instructions in Step 2 of my SmartThings garage door opener guide.
Once the Community Installer is installed, simply open the Community Installer smartapp & search for Webcore to install it.
Once Webcore is installed, click the + icon to add a new smartapp > Webcore.
During the install, you’ll need to give your Webcore instance a name and password. Document this somewhere; you’ll need it later.
Step 9: Choose Devices to Add to Webcore
Next, you’ll need to add devices to Webcore. I recommend only adding the devices you plan on using Webcore with to start.
My Google Mini Cast device is found under Which Actuator? and my button was found under a different section.
Once you’ve added all of your devices to Webcore, open the Webcore smartapp once again and register a browser.
Finally, go to https://dashboard.webcore.co and enter the code displayed on your phone. Then enter the password for your dashboard.
Step 10: Create New Piston
From the Webcore dashboard, create a new piston clicking New Piston > Blank Piston. You’ll need to give the piston a name and title.
For this demo, I creating a piston that says “If Office Button is pressed, have a Google Home Mini device speak text”
Add IF Statement
Click Add Statement > Add Condition > add an If:
Then click Add a Condition:
Select your button and then change the dropdown to Button Gets Pushed. It should look exactly like this:
Add THEN Statement
Click add a new statement under the THEN section. Click Add an action.
When the next screen pops up, change the location dropdown to your cast device. It should be under physical locations. Once all the devices you want are selected, click Add A Task.
Add Task Screen
On the Add A Task screen, search for “speak” and select the Speak Text option.
Enter a text value. This is whatever you want your Google Home device to speak once the button is pressed.
And finally – press Save and then Save the Piston. You can now press the button and it will speak exactly what you type in!
Text Value tips: Only use lowercase letters and no punctuation.
That’s it! You can now create an unlimited amount out automations using SmartThings, WebCore, and Google Home. If you think outside the box a little, you can think of TONS of ways to make Google Home devices “speak”.
For example, I have a Ring doorbell, so I create an automation that that says “If Doorbell is pressed, then speak “DOORBELL PRESSED”.Other fun automations might be:
- If motion detected, then shout BOO.
- If Door opens, then flicker lights on and off.
- If window sensor opens after 10pm, then speak on bedroom Google Mini.
The ideas are literally endless. Hopefully this guide helps you get started!
My Favorite SmartThings Devices
Below are some of the SmartThings-compatible devices I’ve personally used in my home.
- Hub: Aeotec SmartThings Hub
- Smart Plugs: Securifi Peanut plugs
- Motion Sensors: Aeotec SmartThings Motion Sensor
- Camera: Aeotec SmartThings Indoor Camera
- Garage Door Opener: MyQ Chamberlain (works with all existing garage door openers)
The full list of all zwave & ZigBee devices I use can be found on my Equipment List page.
thank You for the detailed step by step instructions. I try to connect ny Ring Doorbell with my Google Nest Hub Max, the way You described. My first question:
– in this case where I want to use only 2 components(Ring and Nest Hub Max) why I need Samsung SmartThings Hub?
I tried to do the setup without the Hub. I managed to go trough steps 1-6. But when I Test API connection, there is no response. Cast-web-api is running, can be accessed from my phone web browser as well, so it is not a connection issue. The only thing I don’t have is SmartThingsHub .
You would need a SmartThings hub for this to work. Part of this setup involves creating a API connection between your SmartThings hub and the CastWebapi app via Webcore. Which, if you don’t have SmartThings or Webcore running, you wouldn’t be able to.
The hub is needed because that’s what is going to perform the communication between SmartThings and your PC/Raspberry. Look at ZigBee devices as an example, if you want to control them, you need a hub.
For this case, the hub is needed so you can communicate with devices in your local network. You can access the website of your Windows PC or Raspberry Pi from your phone, because you are connected to the same network. If you have a hub connected to your local network, then SmartThings will be able to communicate with other devices in the network too (over WiFi or Ethernet).
Remember, SmartThings runs on the cloud. It doesn’t have access to your home network unless you have a hub.
Hi Danny, what Raspberry PI version is good for this setup.
This script is just what I have been looking for.
When I create the device handlers in Samsung IDE it works fine for the first device handler. But when I try to create the second one (Cast web – service manager), with the change from “string” to text” I get an error:
Error: “Groovy.lang.MissingMethodException: No signature of method: script_dth_metadata_53b753f1_18a1_4ad4_beaf_b0939ad8e3bd.appSetting() is applicable for argument types: (java.lang.String) values: [api] Possible solutions: typeSetting(java.lang.String), typeSetting(java.util.Map), typeSetting(java.lang.String, java.lang.String), getSettings(), setSettings(java.lang.Object), typeSetting(java.lang.String, java.lang.String, java.util.List)”
Can You provide help with this?
Quick question, does the PC this is all installed with have to remain on site as a server of sorts for all this to work? Or is everything actually installed into the Smartthings hub and it is doing the work?
I have a button press setup to send me a text when guests arrive to my Short Term Rental but it gives them no audio queues that the button press did anything so they end up pressing it like 5 times! lol Would love for it to say something like Thanks for checking in and enjoy your stay!
I’ll be perfectly honest – I moved away from SmartThings to Home Assistant almost two years ago, so I’m not entirely sure if everything in my guide still works. I will note that this would be super easy to do with Home Assistant, but I remember it being a huge pain in the neck whenever I got this working with SmartThings.
Appreciate you taking the time to answer. Seems like every solution to this issue I read about with Smart things it required a Raspberry Pi or some PC left on site. While I think having the audio queue would be pretty cool I don’t think it is paying $150 for a Raspberry Pi setup cool. Lol
Seems like such a basic function would be built into Smartthings by now