SmartThings Community

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

dth_av
requires_server
project_av
chromecast
googlehome

(macmus) #598

I have not replaced anything for privacy. This is actuall log captured on my raspeberry pie.


(Ryan Murphy) #599

I haven’t been tinkering with my ST for a while so I’ve lost touch with cast-web-api for about 4-5 months ever since I broke it when trying (and failing) to update cast-web-api to a newer version (prior to the 1.0.0 version). In any case, if you haven’t already found it, I’d suggest to use the Docker image from https://hub.docker.com/r/breadlysm/cast-web-api/. I use Synology and I set the image to auto restart while using the same network as the Docker host. Immediately upon running it, the logs recognized all my various Google devices.


(Steve) #600

Hi friends! Sorry for being a dodo. ; )
Can I kindly get some direction for setting this up on Raspbian? Thank you!!!
I tried to follow the instructions.
When I type “cast-web-api”
I get:
-bash: cast-web-api: command not found

Full output:

pi@raspberrypi:~ $ sudo npm install cast-web-api -g
/opt/nodejs/bin/cast-web-api -> /opt/nodejs/lib/node_modules/cast-web-api/bin/cast-web-api

  • cast-web-api@1.0.2
    updated 1 package in 3.426s
    pi@raspberrypi:~ $ cast-web-api
    -bash: cast-web-api: command not found
    pi@raspberrypi:~ $

(Tobias) #601

Hmmm… looks like the install went through.

Maybe just try:
/opt/nodejs/bin/cast-web-api

Sometimes on raspbian only full path works.


(Steve) #602

You are awesome, thank you!!!
It seems to see only 4 out of 7 devices but I will see if I can get it to work at all =D
*** never mind… the smart app itself did see all of my devices upon setup. ; )


#603

Is cast-web-api v1.0.2 the latest release?


(Tobias) #604

Sadly it still is…


(Steve) #605

I’m using this with Webcore. I’m a noob here. Can someone kindly give me an idea how I would pass this an mp3 file stored locally on the raspberry pi I also happen to be running cast-web on? I imagine I have to have some type of http or ftp server running on the pi for a file to be accessible via an URL? Or is there some other way? Thank you!!


(Tobias) #606

Exactly. You need an HTTP server, I’d recommend installing apache/httpd or nginx. Installation should be pretty easy, just google raspberry pi (your raspberry operating system) install apache. This guide should probably cover you. No need to install php, just put your mp3 files into the web server dir (eg. /var/www/html).

You can try it, by opening the http://ip-address/yourfile.mp3 your browser and it should start playing the file.

Now you can either put the mp3 file(s) urls into a preset, or play them through webCoRE.


(Steve) #607

Worked perfect, thank you so much! I really appreciate this community and people such as yourself for sharing their creations AND supporting them. So awesome, you rock!


#608

That advice worked perfectly! This docker worked right away with the default settings on my UnRaid server.

Now, just to figure out if there is a way to remove the cast delay by keeping an always-on cast connection. I have 6 Google Home Mini’s set aside specifically for whole house SmartThings alerts.

I really can’t thank you enough. Cheers!


(Ryan Murphy) #609

Glad to hear it! I will disable my Docker since I really am not well versed in that kind of stuff and to stop messing up people who happen to find it. Cheers!


(Steve) #610

I’m having fun with this in webcore. Is there any way to know when an audio has actually started playing or close to it? Or any way to implement a “wait for audio to start”? (outside of webcore if necessary) I’m trying to synchronize the lowering of my projector screen with a popular cinematic intro theme sent to a chromecast audio connected to my av receiver. The theme happens to be the same duration as it takes my screen to lower. It’s really awesome. =D BUT… the issue is that once the cast request is sent it is really hit or miss as to how long it takes until the audio to start playing. Sometimes the two are in sync, sometimes they aren’t. If I could know when the audio starts (more or less) then I could start the lowering of the screen at the same time.
It usually take about 4.5 - 5.5 seconds for the audio to start from the time of the request… but sometimes it lags out to 10+ seconds. Sometimes there is audio doesn’t start at all.
Ahhh… life’s problems right?

Thanks!!!


(Tobias) #611

Sure, just create an if block in webCoRE. If status changes to ‘playing’ screenshot is attached.
Of course this would need to be wrapped in or perform some kind of ‘is this the lower projector activity?’ check. I guess you don’t want to always lower the project when something plays on that chromecast :wink:


(Tobias) #612

Probably not easy or even impossible. Some info maybe:

  1. Load time varies by group size, internet/wifi speed at device location
  2. Devices are constantly connected to cast-web-api, just not the default media receiver needed to playback custom media and tts is open, because:
  3. You might be playing different media (spotifiy, tunein, etc.)
  4. And most importantly, cast receivers close after a certain timeout without any playback.

(Steve) #613

Hah, thank you!! So simple. It didn’t work yet, however. I’m not sure why this isn’t triggering.
I made simple pistons to test this status change trigger.
One to cast an mp3 and another to listen for the status change.
The mp3 starts playing, and this one does nothing.
“Office Speaker” is one of my Google Home Minis.
I even tried the more generic “Office Speaker’s status changes” (to anything) and that didn’t trigger either.
Any idea why?
(the push notifications are working, I tested that) =D

Thanks again!!! =D

image


(Alwas) #614

I think you have use Location, first, then, send push notification… Have you been on the webCoRE forum? They are very helpful


(Steve) #615

That’s not correct. =D I’m no expert but I don’t need to use location to send push notifications. Thanks!
** correction **… if I open the editor it IS using location. It is there. The issue isn’t with the push notification. I can change the IF to anything that resolves to true and the push works. The issue is with this change status not firing for some reason? Thanks =D


(Ryan ) #616

Hi guys,

What is the best way to use tts through webcore. I was able to get the audio file to play but not get the message voiced.


#617

why is the Smartapp saying v1.0.0 is the latest? Curious…