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

dth_av
requires_server
project_av
chromecast
googlehome

(Antongiulio La Corte) #332

Hi Ryan, I have exactly the same TTS problem you had here. Can you please list the exact command line sequence you executed to stop the previous running version, reinstall from git and run npm install, etc. Many thanks.


(Ryan Worrell) #333

The OP has instructions linked in his guide a bit above. The detailed instructions for cast-web-api are here https://github.com/vervallsweg/cast-web-api#installation


(Antongiulio La Corte) #334

I’m getting the following error while running node castWebApi.js: “Error: listen EADDRINUSE 169.254.41.71:3000” - that’s the usb0 IP address the raspberry PI is running on, whilst I setup castWebApi.js to use the IP address from wlan0 (WiFi) instead. — I can now see that means I’m running another server on the same port. I’ll kill the process and try again. Thanks.


(Matt) #335

Is anyone else experiencing problems recently? All of a sudden I can’t get any of my Homes to play anything via CastWeb. I’ve tried restarting the raspberry pi that the server is running on, but no luck.

I can change the volume via the app successfully, but can’t get mp3s or TTS to work. Has been working for months with no issues.

I know there’s logging happening somewhere. Any tips on how to access those logs?


(Tobias) #336

Playback not working but controls work? Please check the version of the API you’re running.


(Matt) #337

That did it, thanks so much!

Is there a way to disable the sound / tone the Google home plays prior to playback of a cast stream or TTS?


(Tobias) #338

No, sadly not possible since its part of the cast protocol.


(Mike Caley) #339

Hi community
I’m pretty experienced at smart things but have no idea about node.js and would love to get this up and running on my system.
Could someone post or point me to how to setup and install node.js on Windows or in dory node on Android and then install castAPI?

I have tried to follow the steps in the documentation but I need something a bit more basic. I’m not even sure which screens I need to be in and am just getting error messages. I’m sure it’s something very basic I am missing.

Thanks for any help


(Calvin Choy) #340

Hi all,

I notice TTS is not working lately. I see from previous posts that the cast-web-api needs to be updated?

I update my cast-web-api to 0.3.0, when testing using BigTalker2 I got the google bleep . . but the it doesnt say anything. I checked the console output of the cast-web-api and see an exception being thrown:

Exception caught: TypeError: Cannot read property ‘playerState’ of undefined

Did I missed something?

Thanks!


(Alwas) #341

Hey TTS is back, it stopped working on all platforms for about 24 hours, but it’s back, nothing to do with this great dth and smartapp.


(Tobias) #342

Ok, so these two things are related? Will check if my tts works with and without BigTalker.

Thanks a lot :slight_smile:


(Calvin Choy) #343

Can confirm, working again. It was not the apps :slight_smile:


(G) #344

Trying to install on RPi3 running Jessie using this guide,


but can’t get API to respond to the ST app
Any ideas what I’m doing wrong?
Thanks

pi@raspberrypi:~ $ sudo apt-get install npm
Reading package lists… Done
Building dependency tree
Reading state information… Done
npm is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
pi@raspberrypi:~ $ sudo apt-get install libavahi-compat-libdnssd-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
libavahi-compat-libdnssd-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
pi@raspberrypi:~ $ sudo npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
pi@raspberrypi:~ $ sudo npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n

  • n@2.1.8
    updated 1 package in 3.15s
    pi@raspberrypi:~ $ sudo n stable
    pi@raspberrypi:~ $ node -v
    v9.10.1
    pi@raspberrypi:~ $ mkdir castAPI
    pi@raspberrypi:~ $ cd castAPI
    pi@raspberrypi:~/castAPI $ git clone https://github.com/vervallsweg/cast-web-api.git
    Cloning into ‘cast-web-api’…
    remote: Counting objects: 440, done.
    remote: Compressing objects: 100% (38/38), done.
    remote: Total 440 (delta 29), reused 33 (delta 14), pack-reused 387
    Receiving objects: 100% (440/440), 111.41 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (231/231), done.
    Checking connectivity… done.
    pi@raspberrypi:~/castAPI $ sudo npm install
    npm WARN saveError ENOENT: no such file or directory, open ‘/home/pi/castAPI/package.json’
    npm notice created a lockfile as package-lock.json. You should commit this file.
    npm WARN enoent ENOENT: no such file or directory, open ‘/home/pi/castAPI/package.json’
    npm WARN castAPI No description
    npm WARN castAPI No repository field.
    npm WARN castAPI No README data
    npm WARN castAPI No license field.

up to date in 0.845s
pi@raspberrypi:~/castAPI $ cd cast-web-api
pi@raspberrypi:~/castAPI/cast-web-api $ sudo npm install castv2-client
npm notice created a lockfile as package-lock.json. You should commit this file.

  • castv2-client@1.2.0
    added 11 packages from 6 contributors in 7.05s
    pi@raspberrypi:~/castAPI/cast-web-api $ sudo npm install forever -g
    /usr/local/bin/forever -> /usr/local/lib/node_modules/forever/bin/forever
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/forever/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“arm”})

  • forever@0.15.3
    updated 1 package in 39.22s
    pi@raspberrypi:~/castAPI/cast-web-api $ sudo nano castWebApi.js
    pi@raspberrypi:~/castAPI/cast-web-api $ sudo forever start castWebApi.js
    warn: --minUptime not set. Defaulting to: 1000ms
    warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
    info: Forever processing file: castWebApi.js
    pi@raspberrypi:~/castAPI/cast-web-api $


(Tobias) #345

Maybe using the official installation instructions you’ll have more luck: https://vervallsweg.github.io/smartthings/cast-web-installation-guide

There’s now also installation videos. The video for mac (after installing nodejs) should have the same instructions for the command line :+1:

Update: Also the output you posted here seems quite normal. Does it work from your browser? In the video I also paste the address into a browser window and the API responds.


(G) #346

Thank you very much for the reply, I’ll try that, true amateur here :rofl:


(G) #347

When I paste http://192.168.1.118:3000 (yes 192.168.1.118 is static address of my RPi and it was configured as per the posted guide)
I get error can’t reach this page, so it’s not working :cry:
To start over, can I just delete those directories created and start over, or do I have to do some uninstalling first?

Thanks


(Tobias) #348

Reinstalling probably won’t solve that issue. So you run the API and it outputs you the above address to the command line? Seems more like a network issue. Do you have some kind of firewall on your rpi or computer? If not, how are the rpi and your computer connected?

Update: maybe try running it without forever first. It should output the address:port it’s running on. I assume the issue is somewhere there.


(G) #349

Thanks for reply !
The RPi is just headless sitting in the closet running DSC alarmserver to integrate the alarm wit SmartThings. I use VNC viewer to manage it. No firewall that I know of, I can access it remotely without problems using VNC
Is there way to check if the process is running correctly on the RPi and did not crash?
When I try to start it without the forever I get error
pi@raspberrypi:~/castAPI/cast-web-api $ start castWebApi.js
bash: start: command not found

I presume the server is configured properly

const http = require(‘http’);
const Client = require(‘castv2’).Client;
const Castv2Client = require(‘castv2-client’).Client;
const DefaultMediaReceiver = require(‘castv2-client’).DefaultMediaReceiver;
const mdns = require(‘mdns-js’);
const url = require(‘url’);
const debug = require(‘debug’)(‘cast-web-api’);
const args = require(‘minimist’)(process.argv.slice(2));
const fetch = require(‘node-fetch’);
const os = require(‘os’);
const pkg = require(’./package.json’);

var hostname = ‘192.168.1.118’;
var port = 3000;
var currentRequestId = 1;
var networkTimeout = 2000;
var discoveryTimeout = 4000;
var appLoadTimeout = 6000;
var thisVersion = pkg.version;

interpretArguments();
createWebServer();

Thanks


(G) #350

Miracle, changed the default port from 3000 to 3300 and it’s responding now :slight_smile: I presume the port was used by something else?

Thanks


(Tobias) #351

Great!
Was about to reply: You just run it with node castWebApi.js or if you installed it according to the docs with cast-web-api

Probably. The API without forever would output an error message for you :wink: