[RELEASE] cast-web 1.0.0 - Chromecast Device Handler & SmartApps



What command and parameter do I use in webcore to play an mp4-file from my local network?

I have this working in a preset in the smartapp:
“preset1”:{“mediaTitle”:“Smurfarna”,“mediaSubtitle”:"smurf-filmen ",“mediaType”:“video/mp4”,“mediaUrl”:“",“mediaStreamType”:“BUFFERED”,“mediaImageUrl”:"https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png”},

what command and parameter should I use in webcore to get the same file playing when a virtual switch is switched on? I have tried Play() and Play track(

barn-tv-knapp-1’s switch changes to on
Chromecast Livingroom
//Play track or play? “” or something else?

  • add a new task
    end with;
  • add a new statement
  • add a new statement
    end if;
  • add a new statement
    end execute;


(Tobias) #558

Alright. So I managed to parse your presets and they look good. There are two options that could be the problem here:

  1. There is some kind of login or any access check on the file
  2. Have you checked if the codec of your video is even supported by Chromecasts? You can probably figure out the exact codec by playing the file through VLC > ‘Media Information’ .

I’m sorry but there’s nothing obviously wrong and everything is looking like it’s supposed to. This might take long to get working or maybe not work at all…

(Tobias) #559

Yes. Like magic :wink: . No seriously -g installs it globally, somewhere in the npm setup. You just run it with cast-web-api like any other command line utility.

I see where you’re coming from but hardcoding ip/port is really not a great idea.
I’d recommend leaving hostname unchanged, since it now finds the external facing IP on it’s own. Unless thats not the one you want, you can just leave it.

The reason for this change is exactly the painful update process you’re describing right now. If you installed it through npm you could just run (sudo) npm update -g once a new version is released. And since nothing is hardcoded, all the params are appended to the accessing command, you don’t need to change anything afterwards.

If your way works, great! Just updating will be harder if you hardcode stuff. If you change your mind about it, the instructions are linked.

Regardless, have fun with cast-web! :slight_smile:

(Tobias) #560

From version to which version?

Maybe got some other API/bridge running on the same Pi? If yes, which one would that be?

If it’s what I’m suspecting, nothing. It’s just an ST limitation…

(Tobias) #561

Well if it’s a preset you could always use the preset(number) or preset1() function. They should be available through webCoRE. But I assume that’s not what you want :wink:

I just checked and the function you’d need is not exposed since there’s no point in doing so. webCoRE can send API calls straight to cast-web-api. There’s some posts here that I’ll find and link you to. To summarize:

  1. webCoRE HTTP POST request to: http://{api-ip:port}/device/{deviceID}/playMedia
  2. The post data would be everything after “preset1”: up until preset2, ie this:
  1. Including all the original quotes, brackets, etc. (the ST forum alters them, watch out!) and wrap all I quoted in array brackets [ ]
  2. I encourage you to check out the new swagger I just setup. The API definition is still in beta, so you need to change the url to https://raw.githubusercontent.com/vervallsweg/cast-web-api/v1.1.0/swagger.json and click explore.

Here’s the conversation I had with @kayvint about it. Ignore all the v0.3 stuff. This is no longer relevant. It describes using the webCoRE HTTP POST function though to send mediaElements.

(Tobias) #562

Hey there!

I was busy on version 1.1.0 in the past week. Here are some of the new things:

  • Fixed: discovery issues, switched to self made lib mdns-cast-browser
  • Added: GoogleTTS messages larger than 200 character
  • Added: Option for custom device names
  • Added: Google Assistant for broadcasting messages, that don’t interrupt playback

Holy… I never thought I’d add that. I looked at a node library for it and it wasn’t nearly as hard to implement as I expected.
Disclaimer: the broadcast feature is buggy af! For me it only works on some Google Homes (?) and I read on GitHub it doesn’t work for some people at all. Also it’s quite difficult to setup. I tried to make it as easy as possible and a setup video will follow soon, still not as easy as it could be.

Everyone who’s interested in the beta just message me! If you’re on v1 updating should be a breeze and the Google Assistant part is optional.

Last but not least, a video of the unthinkable :exploding_head:

(Jason Meehan) #563

Would love to try the feature that resumes music… the one thing that my wife always nags about…

(Mike) #564

Pre 1 to 1.0 - I hadn’t touched it in a while, since it had been working.

Honeywell Alarm Handler and SmartThings Node Proxy

That’s what I figured - I just moved cast-web to my Windows media server for now, until I stand up another Raspberry Pi. Working like a charm!!! :grin:


Ok, thanks! I’ll check it out.
My plan was (is) to have an entire panel on my Actiontiles-tablet with lots of buttons that each start specific kids tv-shows and kids movies. So my youngest can just tap a button and the file from my plex-nas start playing on the tv. He is still to young to understand the Plex interface and how to cast to different devices.


Definitely “Much happy! Very excite!” for the new functionality coming.

In the meantime, do you know why I get some red messages in the log about my speaker group? The message is:

[TIMESTAMP] [ID - It’s the speaker group ID that has 12 speakers in it] connectGroupMembersInit(): statusChange is NO APP group

I used to have other errors (many) until I decided to delete the group and recreate it. This one doesn’t go away though.


Oh, also, I can crash the node server with a simple piston by putting two “Speak” commands back to back; the first one to a group of speakers and the second to an individual speaker. The messages are different. The error is:

player.queueLoad(newMediaList, {startIndex:0, repeatMode: “REPEAT_OFF”}, function(err, status) {

TypeError: Cannot read property ‘queueLoad’ of undefined
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\castWebApi.js:904:13
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\castv2-client\lib\senders\platform.js:95:20
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\castv2-client\lib\controllers\receiver.js:51:14
at fn.onmessage (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\castv2-client\lib\controllers\req
at emitTwo (events.js:131:20)
at fn.emit (events.js:214:7)
at Channel.onmessage (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\castv2-client\lib\controller
at emitTwo (events.js:126:13)
at Channel.emit (events.js:214:7)
at Client.onmessage (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\castv2\lib\channel.js:23:10)


Thank you @vervallsweg for all the work you’ve put into this!

I’m running an unRaid server and I’ve used the docker that @rfmurphy81 has on DockerHub.

The docker starts without any issues and I’m able to get (on a laptop on the same network) to list all the Chromecast devices that I have.

I was able to link your Github repo @vervallsweg to my SmartThings IDE and create both the SmartApp and Device Handler as well. I’ve done this with many other Z-Wave devices and custom code already.

The SmartApp however, will not connect to the API for testing. It always returns error code 404.
If I open a terminal window for the cast-web-api in the docker from @rfmurphy81, and run “node castWebApi.js” I get the output of “Server running at”.

I’m not entirely sure what to modify to get everything talking.

Any ideas or tip would be greatly appreciated. Thank you again!

(Tobias) #569

Yeah just ignore it. I think the old group playback detection checked for an app running on master. If there was none, it logged what you described. So nothing to worry. Next one uses sessionIDs and only logs this info if you ask it to.

Oh like at the same time? To a group and a member of the same group?

(Tobias) #570

Me neither :rofl:

I know for cast-web-api you just add --hostname=x.x.x.x and/or --port=xx to the command as a parameter.

For docker I really wouldn’t know. I guess if docker calls some kind of bash script on start/stop it would have to run node castWebApi.js or cast-web-api this is where you’d append the parameter. But I’m not sure if that’s all that makes the docker magic work…


Yes, but I think it even crashes if it is to a group and a member not in that group. I think I tested that as well. But, yes, definitely to a group and then again to a member in that group.

I realize that’s not common but I have an actual use case where I do that and I was expecting it to queue up the second device specific response to run after the group one like it does if you do overlapping broadcasts if done through a physical device (your phone or a mini or something). Instead it just crashes (I think every time).


Same problem. I wonder if having more than 1 device caused the issue. I have more than 20 (audio chromecasts, google home and minis).


Hi Tobias, Sign me up! I’ve got 20 devices (combination of audio casts and home & minis).

I can’t save the discovery right now.

(Mark C) #574

when are you planning on releasing the update on githib, mine system seams to be working fine (broadcasting) but would like the resume to work.
Its running on an adroid, which files are beeing updated?

(Tobias) #575

It adds an optional npm packages called google-assistant. I haven’t checked yet whether it works on android at all. It requires a compiler so you might not be able to use the google-assistant on android.

Good one. I think all the major bugs are fixed now. We’ll see how many new ones are coming in in the next days. If all goes well, maybe end of this week.

(Craig Bennett) #576

I’m not sure if you tested this, but one of the things that doesn’t work since I updated my stuff is the following. If you test it, just replace the (server) and (cast device). It should play a doorbell sound through whatever speaker you picked.
http://(server)/setMediaPlayback?address=(cast device)&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}