SmartThings Community

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

dth_av
requires_server
project_av
chromecast
googlehome
(Jg506) #124

Yep figured that by now. Building new one will publish here after testing

1 Like
(Jg506) #125

This docker image is same as other one that was posted in this thread but with the startup CMD removed so when you create container use your CMD with your choice of IP and PORT.
https://hub.docker.com/r/jg506/cast-web-api/

(Tobias) #126

That’s a good idea. Thought about getting the play and resume stuff to work with presets. So if one of your presets is playing and you send a notification, it would continue playing after the notification is done.

As soon as I implement that, I’ll implement your idea as well :+1:

Update:
Added it as a feature for next versions

1 Like
(Ryan Murphy) #127

I’ve decided I want to put this API onto my Synology rather than my Windows 10 machine, but may need a bit of help to figure out which step I’m missing.

  • I’ve set my Synology to a fixed IP on my network.
  • I’ve installed Git Server 2.11.3-0116 on the Synology.
  • I’ve installed Node.js v4 4.8.4-0164 on the Synology.
  • I’ve installed PuTTY on my Windows 10 machine and can successfully root the SSH for the Synology.
  • Running # git clone https://github.com/vervallsweg/cast-web-api.git create a success message. I then am able to switch into that newly created local repository.
  • Running # npm install forever -g provides the following response:

npm WARN optional dep failed, continuing fsevents@1.1.3
/usr/local/bin/forever -> /usr/local/lib/node_modules/forever/bin/forever
forever@0.15.3 /usr/local/lib/node_modules/forever
├── path-is-absolute@1.0.1
├── object-assign@3.0.0
├── clone@1.0.3
├── colors@0.6.2
├── timespan@2.3.0
├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
├── cliff@0.1.10 (eyes@0.1.8, colors@1.0.3)
├── nssocket@0.5.3 (eventemitter2@0.4.14, lazy@1.0.11)
├── prettyjson@1.2.1 (colors@1.1.2, minimist@1.2.0)
├── winston@0.8.3 (cycle@1.0.3, async@0.2.10, stack-trace@0.0.10, eyes@0.1.8, isstream@0.1.2, pkginfo@0.3.1)
├── utile@0.2.1 (async@0.2.10, deep-equal@1.0.1, i@0.3.6, ncp@0.4.2, mkdirp@0.5.1, rimraf@2.6.2)
├── shush@1.0.0 (strip-json-comments@0.1.3, caller@0.0.1)
├── nconf@0.6.9 (ini@1.3.5, async@0.2.9, optimist@0.6.0)
├── flatiron@0.4.3 (director@1.2.7, optimist@0.6.0, prompt@0.2.14, broadway@0.3.6)
└── forever-monitor@1.7.1 (minimatch@3.0.4, ps-tree@0.0.3, broadway@0.3.6, chokidar@1.7.0)

  • Running node castWebApi.js --hostname=192.168.86.100 --port=8080 provides the following response

/volume2/Git/cast-web-api/cast-web-api/node_modules/mdns-js/lib/browser.js:4
const { EventEmitter } = require(‘events’);
^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/volume2/Git/cast-web-api/cast-web-api/node_modules/mdns-js/index.js:14:40)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

I’m not sure how to proceed. Anyone willing to tell me which step I missed? Looking at how I set it up on my Windows 10, I was able to clone the Git, switch to that directory, run npm install then run the same command that’s giving me a token error so I’m stumped for now.

#128

I have cast-web running and I’ve been able to make GH speak using webcore.

I also installed media event renderer but I must say I’m a bit in the dark here.

Since media event renderer doesn’t create a device, how do I have it render French message instead for cast-web?

#129

@vervallsweg

I installed it today and it works flawlessly. Thanks a lot.

I don’t know if you’re still developing cast-web actively but you do, I wonder if you could take a page off this SmartApp in order to let us use more TTS services and languages. I would really really be helpful to me.

If you don’t, do you know what modification i’d Have to try to do to use google TTS for rendering? I’m far from a coder unfortunately :confused:

1 Like
(Jg506) #130

You need install mDNS, AVAHI. Been there and walked away. Resolving dependencies on NAS can take forever. If you have intel\amd Synology I recommend you go the docker route. You will be up and running in 4 steps and 5 minutes.
https://www.synology.com/en-us/knowledgebase/DSM/help/Docker/docker_container

(Tobias) #131

You actually don’t need to anymore. Switched to a pure JS implementation of MDNS. The only thing you need is a recent version of njs. Anything over 6 should do. However somebody opened an issue in github recently and I’ll look into minimum version soon.

1 Like
#133

@vervallsweg,

I bought a 2nd-gen Chromecast (HDMI) for my AV receiver with the intention to include my living room speakers in the GH multi-room audio setup, but apparently there are arbitrary limitations that preclude me from joining that Chromecast device to the “All GH speakers” group within the GH app.

(I’m guessing Google would prefer that I buy the “Chromecast Audio” for that purpose, but 3.5mm analog sources are so primitive, won’t wake my receiver, won’t transmit artist/song info, etc)

I thought I might be able to circumvent that limitation by adding the Chromecast device DTH to the castweb group but so far no luck in having it play a preset on both the Chromecast and the GH speakers; it ends up only playing on the GH devices, and I need to manually play the preset from the lone Chromecast DTH, and what happens then is that the audio streams are played out of sync in respect to each other.

Do you know if it’s possible to do this with cast-web dth/smartapp?

(Peter Murdoch) #134

You can technically route any audio stream to a sink with jack/audacity/ardour/pulse/alsa and convert the raw audio to mp3/opus. It’s been a few years since I did this, so I would have to brush off dust to minimize the requirements, may be audacity alone is sufficient, but you would not hear the stream until it was captured and processed.

(Peter Murdoch) #135

Thanks for the feedback about dlna support. I guess I am stuck with Plex as a dependency for now.

Next goal would be to integrate Amazon prime access to the google home / assistant. Would ST provide any capacity to achieve this via voice instruction (even if but audio only)?

(Oleg Chernov) #136

Hi, I am trying to clone the repo using Termux on android and it asks for user name and password? I am a complete newbie at this, can you help?

(Matt Behnken) #137

I’m terminal, shell challenged. When I run crontab -e I don’t get any options to select in terminal, just 10 or so ~ one on each line. I can only add input to the first line. Should i just add the ‘@reboot…’ line to the bottom of the castWebApi.js file in a text editor?

(Darren T) #138

Hi vervallsweg

I see these in cast-web.groovy? Is TTS implemented? If so how do I use it?

    command "playText", ["string"]
    command "playText", ["string", "number"]
    command "playTextAndResume", ["string"]
    command "playTextAndResume", ["string", "number"]
    command "playTextAndRestore", ["string"]
    command "playTextAndRestore", ["string", "number"]

Thanks,
D.

(Darren T) #139

You need to edit the mdns-js version from * to a version < 1.0.0 in the package.json file before installing. Go to mdns-js web site to get version # I don’t remember what the version is you need to work with node js 4.8. But I have it working with the same version as you on my synology ds214play

(Ryan Murphy) #140

Thanks for the reply. I ended up getting it up and running, thanks to some private messaging with @jg506 (who is awesome). It turned out that I was misintepretting the UI on Synology when trying to make the container stay on the same network as the Docker host. Once I figured that out, everything is awesome.

1 Like
(Vasanth Kumar R) #141

Hello all,
I have installed Device handler and smart app. Also running node JS on Android . However device discovery is not working (APP version 0.1). If I enter “Test API connection” option in smartapp, I keep getting error “Connection error: HTTP response code:404”. Device Discovery doesn’t pull up any of my GH device(0 devices found). Any pointers would be helpful. Thanks in advance !!!

(Vasanth Kumar R) #142

Hello Folks,
Looks like I was using incorrect IP for node JS since router reboot happened. After correcting this, I am able to cast audio files from browser using “setMediaPlayback”. However I am not able to copy the same into preset. Whenever I copy a value into preset, it overrwites it with an empty value once I click Next. Any pointers on how to populate the preset object? Since it is a long string, would appreciate if someone can share the method to update the present object from browser instead of mobile device. Thanks in advance

#143

i’m beyond confused as to why this is happening when I try to install but in the node.js command I get the following:

C:\Users\joshu\Desktop\cast-web-api-master>node C:\Users\joshu\Desktop\cast-web-api-master/castwebapi.js
events.js:136
throw er; // Unhandled ‘error’ event
^

Error: listen EADDRINUSE 127.0.0.1:3000
at Object._errnoException (util.js:999:13)
at _exceptionWithHostPort (util.js:1020:20)
at Server.setupListenHandle [as _listen2] (net.js:1379:14)
at listenInCluster (net.js:1420:12)
at doListen (net.js:1535:7)
at process._tickCallback (internal/process/next_tick.js:152:19)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3rd_place_medal:
Any help would be greatly appreciated.

1 Like
(Jg506) #144

Port 3000 is in use by some other app. Use a different port.