SmartThings Community

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

Either use the current master and get the old Bose SoundTouch app, or wait a couple of minutes till I fix the methods :wink:

thank you sir…waiting…:wink:

Ok, this should fix it for now https://github.com/vervallsweg/smartthings/tree/cast-web-v0.1/device-handlers/cast-web

Correct me if I’m wrong but the Reference for Audio Notification says playTrackAndResume takes two parameters. However the speaker companion app tries to call the method with three parameters (STRING, STRING, null). Obviously there is no such method since I implemented everything according to ST documentation with STRING uri and NUMBER level.

I’ll have to invest some time and investigate that, since this is a really dirty fix not in accordance with the docs.
My ST hub was supposed to arrive yesterday already, fingers crossed that it arrives tomorrow. Then I’ll look into it, and start working on the backlog.

1 Like

No worries…take your time.

BTW - Updated DTH and getting this in ST logs: error java.lang.ClassCastException

1 Like

When do you get that? Always, trying to do x? Does the Speaker companion app at least work now? Works for me

can this be used as a “Siren” in SHM?

I.e, alarm is triggered, set siren to speaker and play audio file - “The police is being called, please leave”

Just tried SHM for the first time. In theory possible since the alarm capability seems quite easy to implement. Why not use the speaker companion app in combination with a motion/presence sensor?

Never tried that. Where do I get that?

Just noticed you posted a fix for the speaker companion smart app. Just tested it and everything thing is working great. As a side note in addition to the previously mentioned smart apps in this thread that work with your DTH. I recently discovered another awesome Smart App for announcements and notifications that works with your device handler, it called Remindr and I highly recommend it. Its probably one of the most powerful notification SmartApp I have personally come across. Regarding installation on Windows, I imagine writing install documentation for it would be very difficult, it seems like there are so many variables. I wish I had documented what I had to do, but I tried so many different things troubleshooting that I gave up and just started googling each error trying multiple things until I could proceed to the next step. It took almost two days to get it working but it was worth it. On the positive side I learned quite a bit along the way and now have an awesome poor mans sonos that works great :smile: Thanks again!

Link to the previously mentioned, Remindr Smart App which also works with your DTH.

1 Like

This looks good so far. Just can’t get it to work. Maybe its me. What is your settings in App? I created a new remindR with default notification with trigger of a light switch to test and used music device i added via ChromeCast app and nothing.

Can anyone help with the mDNS setup? I keep getting error “npm not a valid…” and so on. I installed bonjour, python and Microsoft visual studio and can’t figure out how to get shell to recognize npm command.

So you’re on windows? Did you use the npm package build-essentials (something like that) or did you try to download and install all the things manually? I never got manual to work either, so if you did that, I’d recommend uninstalling python/vs and installing it again through the npm package.

Hey, just replaced the old mdns stuff, with a pure node-js implementation. Installation is now much easier, the docs in this branch are also updated. If you want to give it a try download it from here scroll down for the updated installation instructions.
Keep in mind that this branch is still under development and there are many bugs. Devices missing or duplicated on discovery are just some of them.

If you try it, let me know if you encounter more bugs than the ones I just listed.

Thank you for the info and update, i’ll give it a try tomorrow and let you know how it goes. I can’t wait to get this set up!

i managed to get this install and device discovery works. So far, i can only hear sounds from chrome cast audio and google home when i set volume. However, when using webCore to send Speak command i don’t hear anything (except for the volume change). This is the error i am seeing:

Request to: /setDeviceVolume?address=10.14.122.124:8009&volume=0.7
Request to: /setMediaPlayback?address=10.14.122.124:8009&mediaType=audio/mp3&mediaUrl=https://s3.amazonaws.com/smartapp-media/polly-tts/salli/can_you_hear_this_.mp3&mediaStreamType=BUFFERED&mediaTitle=SmartThings&mediaSubtitle=SmartThings%2520playback&mediaImageUrl=https://lh3.googleusercontent.com/nQBLtHKqZycERjdjMGulMLMLDoPXnrZKYoJ8ijaVs8tDD6cypInQRtxgngk9SAXHkA=w300
(node:7967) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Cannot find module ‘castv2-client’
(node:7967) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What am i doing wrong? BTW, i have installed node on my Mac.

EDIT: Fixed it. Needed to do a npm install castv2-client

1 Like

I’m trying to get an mp3 that i have hosted on my dropbox of a dog barking. I am using webCore to automate when motion is triggered to play on my chromecast the selected mp3. I am using the Play Track and i’m entering the link - “https://www.dropbox.com/s/rkxq2n2nxaariu3/Vicious-dog-barking.mp3” but it’s not playing.

Is there something i’m missing with this?

Just curious if there is a way to make the app refresh faster?
There is a ginormous delay detecting when my chromecast is playing and when is stopped or paused.

Thanks for the help!

Yes and no.
Right now the DTH is one way, request to API > Chromecast and then a response. It’s possible to keep API and Cast device constantly connected and send every update to the DTH. That requires quite some work on both sides. That’s the yes.
However in recent months I came to the conclusion that most functionality should also be possible with ST itself and maybe some cloud server that does certain things ST doesn’t do. If that’s the case, there’s no need to deal with the API anymore and upgrade it. Thats the no.

But you have set the update time in the Smartapp to 1min or sth shorter then the default right?

Isn’t the nodes.js running on a separate device obsolete - considering this: http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/building-the-service-manager.html#building-servicemanager ?

I have tried the service manager smart app, and with some minor amendments it discovers all my chromecast capable devices (have not tried any other ssdp search targets).

If so, a small rewrite of the chromecast device handler should do it?

  1. That’s basically what I said in my previous post.
  2. The link you provided says (and this thread hear as well) that only ssdp is supported right now. SSDP discovery for Google cast is outdated and only discovers devices, no groups. It’s probably just a matter of time, till Google kills it completely. According to ST staff they’re working on mdns, no ETA though.
  3. Protobuff is still an issue, somebody pointed it out in a different forum topic already. Protobuff was either not working at all or broken. That could be replaced with a cloud instance that just protobuff encoded / decoded.

Long story short: wait till ST supports mdns. Then look into the possibility of a cloud instance doing the heavy lifting for ST.

2 Likes