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

Thanks for creating this!
…but i cant get the cast-web-api working to run properly on my RaspberryPi :frowning:

I’m running Raspbian Jesse, NPM 5.0.0 and Node 7.10.0

When I run castWebApi.as, I get warnings about Node not using Avahi native API, and then confirmation of the server listening on port 3000, however I am unable to connect via the Smartthings smartapp after entering the IP address. When I port scan the server IP, there are no services running on 3000. When I visit http://localhost:3000 I get a 404 and can see the requests output on console where I started castWebApi which makes me think its a firewall issue but there is no firewall set up as default on Raspbian as default and we are dealing with local network access anyway!

Any ideas guys?

The avahi messages are normal. 404 on / is also expected behavior. I’ll probably change that to some kind of success message. Try running a command like htttp:// that should output a JSON array of devices on your network.

If you still cannot access it from the smart app, make sure that you have set --hostname when starting the API. It defaults to local host as host name if you don’t specify it, meaning it can only be accessed on your local machine.

I’ve followed your directions on installing node.js and the Windows dependencies but I keep getting errors when I run “npm install castv2 castv2-client mdns debug http url minimist”:

Seems like a compiler error at first glance… sorry but mdns on windows sucks… :unamused:

Ok so you have installed the build-tools? Have you rebooted the computer afterwards? I have experienced that in the past already, after installing the build tools. Reboot should fix it.

Let me know if it still doesn’t work and I’ll have a closer look as soon as I come home :slight_smile:

1 Like

Looks like the restart helped, but now I’m receiving a different error while running the same command:
npm ERR: code E404
npm ERR: 404 not found: cast2@latest

Check the command you ran if it’s really the whole list of dependencies. If it’s correct split it into mdns and everything else:

  1. npm install castv2 castv2-client debug http url minimist
  2. npm install mdns

If it still doesn’t work either post the full command and its output, as text or screenshot, whatever you prefer.

First off, thanks so much for your help with this. The error appears to just be with mdns. Here is the output:

C:\Windows\system32>npm install castv2 castv2-client debug http url minimist
npm WARN System32@1.0.0 No description
npm WARN System32@1.0.0 No repository field.

added 14 packages and updated 1 package in 2.64s

C:\Windows\system32>npm install mdns

mdns@2.3.3 install C:\Windows\system32\node_modules\mdns
node-gyp rebuild

C:\Windows\system32\node_modules\mdns>if not defined npm_config_node_gyp (node “C:\Users\McNannay\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\…\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “” rebuild )
MSBUILD : error MSB1009: Project file does not exist.
Switch: build/binding.sln
gyp ERR! build error
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\McNannay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:285:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Users\McNannay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” "rebuild"
gyp ERR! cwd C:\Windows\system32\node_modules\mdns
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
npm WARN System32@1.0.0 No description
npm WARN System32@1.0.0 No repository field.

npm ERR! errno 1
npm ERR! mdns@2.3.3 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mdns@2.3.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\McNannay\AppData\Roaming\npm-cache_logs\2017-05-31T23_28_18_449Z-debug.log

1 Like

Sorry for the late reply. It’s been a really busy week and the rest of the month won’t be any different. I’m currently moving, have to renovate the old place and the new one.

Anyways, this looks like a compiler error now. Honestly I’m not a windows guy, I only use Windows when I absolutely have to. I’ll try my best to help you out. Here are some things you should check:

  1. Installed the Bonjour SDK? Check your control panel > installed programs (or wherever MS moved in in Win10)
  2. Installed build tools from an admin shell ‘npm install -g windows-build-tools’
  3. Check control panel > installed programs for: Python 2.7.xx and MS Visual C++ Build Tools
  4. Try running npm install mdns from an admin shell

If none of that works, let me know. I’ll make an install video shortly.


Hey @vervallsweg, thanks for your help with the setup issue, I completely missed the --hostname switch when I followed the instructions!

Did you have any luck with the Speaker companion app you were talking about? I only mention because the Bose (Connect) app crashes Smartthings for me and although the Control app is able to see my Chromecasts and looks like it should work, nothing seems to actually play when I test. This in fact matches the rest of my experience so far with the device handlers in that I have all my c-casts listed as things, and they display what was playing on them but the controls do nothing and I’m unable to change what is playing via the presets (I’m testing with an MP3 that I converted from a wav file) :frowning:

Yes I have had. It’s now fully supported, just need to merge it into master and write some kind of update mechanism. If you’d like to try use the DTH in the v0.1 branch. After the update mechanism is in place, I’ll merge it into master, update Docs and finally upload a video :slight_smile:

The controls do seriously nothing? Play/pause should only work when the DTH knows what is currently playing. So you’d need to refresh (or wait for it to refresh) till it displays what is currently playing. The volume, mute, stop should always work. Skipping, reversing doesn’t work at all due to the design of the cast protocol. However you can assign different functions to them in the device settings.

Last but not least the presets, well the generator still needs some love. It should warn the user if somethings wrong, probably not playable and more media types. I’m just guessing the files you’re trying to play are not in a http:// network location? I think they don’t need to be on the web, on your local network should be fine, but on a HTTP server. Post the presets here or DM me if you don’t get them to work.

I stumbled across this thread last night and was intrigued because currently I’m using BubbleUPnP to expose my Google Home as a DLNA Media Renderer, which feels sub-optimal to me for a number of reasons. I’m in the process of creating the world’s crappiest Docker image to run the node.js proxy on my Synology without having to use a chroot jail. If anyone else is interested in it I’ll link to the image once I have it working properly.


Sadly I sold my Synology NAS years ago, thought they ran node.js natively as a package. Getting the mdns stuff installed is probably the hardest part. I’ll hopefully replace the current mdns-dependencies with a native node solution soon.
If you’re still working on it, good luck!

The mdns dependencies are exactly why Docker seemed like the best solution, because the Synology OS doesn’t include them and there is no “easy” way to install them as far as I can tell.

First of all thank you for your work on this. Being a complete newb to node.js on windows, I was after much troubleshooting I was able to get the node.js server running and reachable. However after getting everything up and running and all devices discovered I am having an issue, when I try to play an announcement with the Speaker Companion Smartapp nothing happens. Below is the beginning of the request on the server, and then it throws an exception. I am using the DTH in the V.01 branch which as I understand it should support the Speaker Companion Smartapp. Not sure what I am doing wrong maybe this is not to meant to work the way I am trying to use it? Hoping you can give me some guidance.

Request to: /requests/status.json
Request to: /requests/status.json
Exception caught: TypeError: Cannot read property ‘send’ of undefined
Exception caught: TypeError: Cannot read property ‘send’ of undefined
Exception caught: TypeError: Cannot read property ‘send’ of undefined
Request to: /requests/status.json

Got API, DTH and SmartApp going. Added devices to ST and various Sonos and Bose app. Now how do I send alerts? Do I need to use the presets? If so, how do I configure them.

{“preset1”:{“mediaTitle”:“Preset 1”,“mediaSubtitle”:"",“mediaType”:"",“mediaUrl”:"",“mediaStreamType”:"",“mediaImageUrl”:""},“preset2”:{“mediaTitle”:“Preset 2”,“mediaSubtitle”:"",“mediaType”:"",“mediaUrl”:"",“mediaStreamType”:"",“mediaImageUrl”:""},“preset3”:{“mediaTitle”:“Preset 3”,“mediaSubtitle”:"",“mediaType”:"",“mediaUrl”:"",“mediaStreamType”:"",“mediaImageUrl”:""},“preset4”: {“mediaTitle”:“Preset 4”,“mediaSubtitle”:"",“mediaType”:"",“mediaUrl”:"",“mediaStreamType”:"",“mediaImageUrl”:""},“preset5”:{“mediaTitle”:“Preset 5”,“mediaSubtitle”:"",“mediaType”:"",“mediaUrl”:"",“mediaStreamType”:"",“mediaImageUrl”:""},“preset6”:{“mediaTitle”:“Preset 6”,“mediaSubtitle”:"",“mediaType”:"",“mediaUrl”:"",“mediaStreamType”:"",“mediaImageUrl”:""}}

I have the same issue.

Let me know if you have any luck figuring this out. I’ll do the same. Im not even sure if you can use this smart app to play custom announcements either through sonos app or using speaker companion app, or if you must use the presets. Love my google home and chrome as the this would make them even better.

I know, setup is a pain especially on Windows. As soon as I find time, I’ll make it easier to install. Yes I can confirm that behavior with the new Speaker companion app, I experienced it myself in the past. Fix for that should be quite easy and will do it soon.

No the presets are just for web content like radio streams, not for announcements. If you want to configure them, just click the link in the device Settings. It should open up your browser with the editor. Give every preset you’d like to use a name, paste in a stream/image URL, and select the matching format options. When you’re done click next, and copy the new object. Go back to the device settings, paste the new object in and click done.

So how is announcements done?