SmartThings Community

[RELEASE] cast-web v1.2.1 - Chromecast Device Handler & SmartApp

The consideration for hard coding the IP did cross my mind as I was falling asleep this am…(though not necessarily how and where to do it), but at the end of the day, that’s a hack that, even if I successfully did that, I might find that my newly-hard-addressed Shield was actively refusing port connections, or…who knows? --and the saga would continue.

So I found a guy on Craigslist who lives 3 miles away and has a brand new in box V2 he’ll let go for cheap. Picking it up this morning, and fingers crossed.

I’m actually adding a new Lutron controller into the mix this weekend and moving a bunch of my lamps and dimmers to other devices anyway, so I guess it’s as good a time as any to start over. I’m just sweating bullets about my pool controller! --But that was the very first thing I ever did with ST, and I didn’t know anything about this stuff then…so maybe it won’t be so bad this time around.

Thanks for all your help, @Matt_Behnken! I’ll definitely let you know if this solves it!

P.S. Just under that post you linked, people say it looks like the latest firmware solved the issue…but I think they’re talking about the port blocking issue–which maybe it has. That’s what the release notes say. They don’t mention anything about the IP address issue, which I clearly still have after that listed update AND another…so perhaps that fix really never is coming. At the end of the day, it doesn’t matter for the operation of most things–I have many DTHs and smartapps and things that are talking via WiFi and web, etc. But for things like this that are merely talking over the LAN, it seems like a fatal flaw.

1 Like

Ugh, starting over sounds awful.

Hahaha! Well, it sounds like a project. I probably don’t have quite as much custom stuff going on as you.

I do wonder though, about best practices for moving to a new hub. Should I add this as an additional hub and migrate stuff to it gradually? Or is that even possible? Should it be a “delete the old one, start from scratch” deal? I will certainly look into it on my own…but if anyone happens to know a good thread or resource about options there, I’m all ears. Got my brand new V2 hub in the car. In the end, if Cast-web works as well as I hope, it will be well worth the money and the time spent to get it up and running.


New hub did the trick, just as expected. :blush::+1:

Thanks everybody for your help and not giving up. Hopefully my posts will serve as a lot of info and save someone from the same hair-pulling couple weeks+ I’ve dealt with! Now, to get all my custom stuff and routines, action tiles, etc etc etc set up! :expressionless:

… And eBay this old smartthings link…


Wow! Well, you knew you were doing it right all along (and helping others). I was saving this tidbit, on my new pi 3 B+ I set up cast web API with forever, using Cron tab with static IP in just under an hour from unpacking it. It’s quite a device! There’s so many ST node.js scripts. I’m doing a harmony hub one that makes devices controllable instead of only harmony routines.
Maybe u @DesignDawg or @Ryan780 or @David_Van can tell me what docker is all about? And maybe delete your ST logs from above or just great out the device IDs? I’ve seen some weird hacks using device IDs.

Thanks for the advice about device IDs!
And thanks for the word on controlling harmony devices! Agreed about the power/ease of the Pi. I’m using my pi to run a print server to make a thermal printer I use for my eBay business wireless, and I’m running a server that allows me to use Lutron Pico remotes as buttons for SmartThings (i.e. not having to control Lutron devices directly).

Do you have any info on the Harmony thing? Would love to check that out…there are some specific things I’d LOVE to be able to do with that!

Thanks again, everybody…I’ve got everything back in on my new hub, with many devices, ActionTiles, cast-web, Nest integration, Lutron, google home, harmony, webcore, and a few simple routines built already.
Just have to get my pool controller raised back up from the dead. That pool controller was the VERY first thing I did with ST, and was the reason I bought the ST Link in the first place (and my first Google home)…so you could say my pool got me into home automation. But, what a doozy as a first project. I’m hoping it’s easier this time around. [edit – It was. :)]


One example of how I use the Harmony API integration is to pause the TV if I am home and the doorbell is rang or if specific contacts call my phone.

I wish my pool was smart. I’ve got a fairly new variable speed pump from pentair. The smart add ons are literally hundreds of dollars. How did you set it up, i’d be very interested to setup myself?

Here is the kukuharmony community smart app for harmony devices as things instead of routines… @David_Van is the expert. j/k i saw him on that thread too.

Ultimately I’d like the samsung tv to pause when the doorbell rings and show the video feed on the tv. But that’s for another thread…

Hey, great, thank you for the link! I’ll definitely get that installed and play around…The more I can integrate the stuff I have, the better, right?

As for the pool, I bought an Intermatic PE653 several years ago, before I knew about or had any home automation plans. I had a passing knowledge that ZWave was a home automation standard, and the remote and the control center speak to each other in ZWave, but I didn’t have any immediate plans to do any of that. --I just had really poor access to my old dial timers, and my wife and kids couldn’t turn things off when they wanted to swim while I was at work. --So I got an all-in-one system to replace all my switches and timers. Last year, I got the itch to make it smart, and possibly voice control it (didn’t think that was really possible), and discovered that someone had been working on it for years for smartthings. Having an NVidia Shield already, I figured I was $40 for a ST Link away from getting it done. I was right (and voice control was super easy), but it was steep learning curve for a first-ever device. Works absolutely beautifully.

Is there any way to configure the cast-web-api device manually? My problem is I have my ST hub and all of my IoT devices on a different subnet than my google devices. I have the api running on a raspberry pi on the same networks as the google devices, and when I point the app to the api’s ip address it sees it and will see the discovered devices, but when it tries to add the first device it says it can’t add the cast-web-api device because it cant pull the mac (because the mac wont cross subnets). I tried working around this by running the api from the IoT subnet and adding the api and a device that way, then going in through the IDE and updating the network address to the mac of the pi on the 1st network and updating the ip in the app to match. This seemed to work at first and I was able to add my google devices, but when I try to access them from the things menu it seems to crash the app.

So, long story short, any way to get this to work across subnets?

check this out. it gives static upnp responses across subnets for google cast devices. which might work for your latter setup with iot and api on subnet 2 but cast devices on subnet1.

Basically access your chromecasts from another subnet.

using crontab can be difficult if you don’t know the syntax. The path can change on boot and you need a wait after boot to start the script. Forever keeps the api up, but needs to be restarted on boot.

I use pm2, it’s easy and has a really nice web monitoring interface and it’s free. basic setup is (assuming you’ve already installed node.js and cast-web-api npms on your pi, you might want to update node.js if you haven’t already. you can check with $ node -v) Also, static IP for PI is required.

$ npm install pm2 -g

$ /yourpathtonodesfolderonpi node npm2
(i think my command was: $/opt/nodejs/bin node pm2) so now pm2 should be installed on your pi and currently running on your CLI.

$ pm2 startup
select the text and copy it to clipboard, paste it to the $ (as per the onscreen instructions)

$ pm2 start castWebApi (or whatever your cast-web-api.js file is named could be start cast-web-api)

$ pm2 save

$ pm2 list (to make sure the cast-web-api is running and will start on boot)

$ pm2 plus

Sign up and register or whatever then you have to hit “connect” on the web page to enter keys. Then you can monitor your api status from the web and if you want notifications as well if it’s offline or something.

If you get stuck the steps are on the pm2 git readme, heres a screenshot of my web dashboard


well now you essentially have smart speakers as devices. So you can use other apps to send sounds, music, tts or whatever you would like at the perfect time. the community app “bigtalker” is great and of course webcore is awesome. Announcements like ‘alarm armed’ or welcome home your majesty or somebody is at the front door, etc.

Not really sure how to get this working. I followed the install instructions on the site but when i try to run the commands it keeps telling me command not found.

I haven’t tried it out yet. It’s python script. I check it out when I get a chance.

just realized my notifications are not coming out from my google devices.

when i check if “forever” is running. this is what im getting

C:\Users\user\AppData\Roaming\npm>forever start cast-web-api
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: cast-web-api

looks like id have to set --minUptime? but i dont think it was mentioned on the install instructions.

You shouldn’t have to set that.
You say when you check to see if forever is running…what are you doing to check that?
The main thing you want to see is if forever is running cast-web-api. To do that, you type

forever list

It’ll either tell you nothing is running, or tell you what is. If cast-web is working properly, that minUptime thing is irrelevant.

You don’t have to set minimum up time. forever is a different package. It keeps the API running and can restart it if it errors out but needs a Cron tab or similar to be restarted after boot. You can set minuptime

--minUptime milliseconds for a script to not be considered “spinning”

Seriously try pm2 it’s a much more visual version of forever.

1 Like

you don’t have to set anything. But you do have to run the forever command every time your server starts. Or set it up to auto-start with the forever script. If you don’t like forever, use whatever you want. But I’ve been using forever for over a year and never had a problem.

1 Like

I can control my devices (see chromecast playing), but when I select any of the cast-web-device, my phone goes black and it reopens “My Home” tab. Any suggestions would be appreciated