[RELEASE] cast-web v1.2.1 - Chromecast Integration (EDGE Driver discussion begins in post 1668)

SONOFA… C’MERE SO I CAN KISS Y… Um, I mean, grab you in a manly one-arm hug. LOL That did it! Fixed all five of them. THANK you!

Now… NOW… To use WebCore to make them say things when things happen!!! I watched a video where the dude walked through the cast-web-api installation and then used SmartTools (instead of WebCore) to get it to work, but I imagine they’re alike.

2 Likes

Working on a video right now to do all this with webCoRE and a raspberry pi (hopefully later this week). :slight_smile:

Its pretty easy though if you are familiar with webCoRE, just make sure to add the devices in to webCoRE and then you’ll have the different options

Yep, adding to webCoRE now, will test in a bit.

Any way to speed up between the switch turning on and the device speaking?

I’m looking into that. Right now my Pi is on the second floor connected on wireless. I am going to see if it being wired helps. This goes over the Internet though so its going to be at the mercy of the Internet. I also think its going to depend on the wireless connectivity for your Google Home devices.

I plan to test the devices on different floors to see if that speeds response time up or not. If you look in the webCoRE console, its very fast to push the commands to cast-web-api so not 100% sure where the slowdown is yet

It seemed like 20-30 seconds delay between switch and speak. Here’s the webCoRE log:

speak

Other than timing - It seems to work! Woohoo!

Of course - I have questions!

Lets say when I turn a switch on, I want my living room, office, and basement Google Devices to say “The switch has been turned on.”

In Webcore, I can just use “speak” and then type “The switch etc etc” in the “Value” field.

I need help with a few things:

Lets say that the living room is currently playing music. I want the music to stop, the speaker to announce “The Switch etc etc” and then the music to resume. But ONLY the living room speaker - the other two were not playing music.

Lets say that although none of the devices are currently playing music or anything. I want all three to speak, but in the basement i want the volume to go to 90%, speak, and then back down to where it was.

I’m going to head to the webCoRE forum and ask some questions about the other options, but so far, I’m well pleased!

I am having trouble getting cast-web-api-cli to run on startup on raspberry pi. I did the startup command followed the directions. A few minutes after boot I can see its running but then the status shows its not running until I start it.

When I add the SmartApp “Cast Web - service manager” in the SmartThings mobile app, I don’t get prompted for the API IP address and I don’t see any way of manually entering it. Any suggestions?

It appears it’s just adding it with a blank “apihostaddress” field:

You need to use the classic app to configure it

Checking in after 8 days of use. It works great still! I have it announcing driveway motion, I have it announcing when X door opens (a few different doors). I even have a door contact switch in my mailbox which is across the street and Google tells me “You’ve got mail!”

I did not get my answers above answered in the Webcore forum - I was advised to try them and see what happens. I mean, yes, that is a way, but I was hoping someone could have TOLD me and saved me the time. No big deal, they’re not required to tell me, and over the years they’ve been VERY helpful in other ways.

Curious: If, instead of having Google “speak”, what if I wanted Google to play a short mp3? How would I do that, and where would I need to store that mp3?

I have not done this myself but I believe you could get Webcore to play an mp3. I just searched for “play mp3” on the webcore forum and got plenty of hits.

I did too - I tried it, did play, play and resume, play this, play that… I can’t get it to work - but I think my problem is dropbox doesn’t allow mp3’s to PLAY, it just goes TO them.

In work… :slight_smile:

I’m pretty certain for music playback it has to be “DRM Free”. I’m not fully sure of the inter-workings on it though.

Oh, these are just mp3’s I’ve recorded of my voice (and my sister - she’s in radio) saying “There’s someone in the driveway”, The basement door has been opened, that kind of thing.

Sidenote - I just realized I follow you on Reddit!

Just set this up and got server on my PC but the individual devices don’t show up in ST Classic. All the installation videos seem to be deleted. Anyone got any help?

Here’s a installation video that’s not deleted… lol… https://youtu.be/YbW2TAyx0ko

If you are getting a Connection Ok 200 message when you test the API connection make sure your Google Homes are on the same network as your smarthub / PC running cast-web-api

Oh neat. I honestly haven’t done anything like that I just use TTS so I am probably not going to be the most helpful with that.

Based on this FAQ for it though it says just needs to be accessiable without login so I think your assumption is correct: What can I play through presets? - cast-web

Ha! Well thank you :slight_smile:

Hi @vervallsweg -

Thank you for your work! I was using Cast-web-api successfully for the last few years … then I went to update it (silly me!) … I previously had been running it on a Pi Zero, but after trying to update it I found that the Arm library issue (which I assume is still not fixed) … anyway, I moved cast-web-api over to my Mac and installed the Cast-web-api-cli from github … It is working sort of … I have been pulling my hair out to figure out why.

I have two use cases in my setup …

Case 1: is a separate Pi Zero running an app that monitors Presence and does various things, including announcing when someone arrives. That used to work fine, but after the upgrade it stopped … after much debugging … I traced it back to the requests.post in my python code. For some reason I had to add the ‘headers’ to the call which previously was left out (and worked fine w/o it).
I added:

headers = {'Content-Type': 'application/json'}
requests.post(speaker+"/playMedia/", data=d, headers=headers)

And now that app works fine.

Case 2: The other problem is with Webcore / Smartthings. I wrote the following test piston to demonstrate it:

This piston uses two methods to speak some text … the first string uses the method I was previously using which worked fine … now it doesn’t … the second string uses a brute force method which works fine.

I both cases, an examination of the cast-web-api-out.log file reveals the issue. I’ve included the last few lines after I run the piston:

new status: {“groupPlayback”:{“on”:false,“from”:“26052C0F-832A-4096-8773-1B6C12378F1A”},“application”:"",“status”:"",“title”:"",“subtitle”:"",“image”:""}
message broadcast: true
playMedia: {}
2020-06-26T20:14:13.969Z 37aa113f97c9dd45e6ef23dbb9d08a4c CastDevice.playMedia(): exception: TypeError: media.forEach is not a function
playMedia: [{“googleTTS”:“en-US”,“mediaTitle”:“This is the second string to speak”,“mediaSubtitle”:"",“mediaImageUrl”:""}]
message broadcast: true
sessionIdChanged: null
message broadcast: true
sessionIdChanged: 25a935c8-1417-4727-b509-e846137c40f6
message broadcast: true
message broadcast: true

the “playmedia:{}” occurs in both cases when it fails (obviously since its a null string.) The question is Why?

I have read through this thread and googled for others but did not see anything that addressed this.

Do you have any insight as to why this is happening? As an aside, other Smartthings apps (like speak the weather) also no longer work and exhibit the same symptom of the null playmedia:{} …

Thanks for any pointers you may have for me to try.

Hello All. I have release 1.2.1 installed on Windows 10 with the latest node software as well. I am receiving the following error sporadically which causes it to crash. It will not restart the cast-web-api service once it occurs. If I reboot the entire system it restarts. Unfortunately, the error always eventually crops up again.

groupsUp: {“id”:“2e1adf84a8077ce955e9f6ea94c0cc02”,“groups”:[“e92a7f6c-7d39-4d0f-b92c-5af7f9fe000b”]}
message broadcast: true
sessionIdChanged: 2b074a8c-443c-4617-87d7-cdee5ee1c726
message broadcast: true
Uncaught Cannot call write after a stream was destroyed
message broadcast: true