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

dth_av
requires_server
project_av
chromecast
googlehome

(Daniele Bonato) #577

Hello,
i want use the web-cast for notification on google Home. I have installed web-cast on linux and the program is in listening on http://:3000, i want use webcore for send notification to google home.
But i don’t find any guide regarding this.

I can send a POST request to http://:3000/device/8f9aba477f0d1e166ca364976d1f02bb/playMedia using JSON?
The WEBCore add always the { before and i cannot write the correct form for the POST.

I need

Code WEBCORe
Make a POST request to http://: with {“mediaTitle”:“TEXT”,“mediaSubTitle”:“TEXT”…}

I NEED
Make a POST request to http://: with [{“mediaTitle”:“TEXT”,“mediaSubTitle”:“TEXT”…}]

There is a way for edit manually the webcore code? or another system for send a correct JSON di web-cast software?


(Tobias) #578

Yeah everything is different in v1. The documentation is on the GitHub repo. For a more visual overview check out the new swagger and replace /master/ with /v1.1.0/ in the address bar.

setMediaPlayback was replaced by /device/{id}/playMedia (POST) or /device/{id}/playMediaGet in your case: http://(server)/device/(cast device id)/playMediaGet/[{ "mediaTitle":"mediaTitle", "mediaSubtitle": "mediaSubtitle", "mediaType":"audio/mp3", "mediaUrl":"http://techreviewsandhelp.com/wp-content/uploads/2018/06/Someone-is-at-the-front-door-1.mp3", "mediaStreamType":"BUFFERED", "mediaImageUrl":"mediaImageUrl" }]


(Tobias) #579

The documentation is on the GitHub repo. For a more visual overview check out the new swagger and replace /master/ with /v1.1.0/ in the address bar.

Yes. Check the docs or swagger for more info.

Why don’t you just add an action: select the cast device from webCoRE, then use the speak() command on that device?

Why send direct api calls through webCoRE if you can just select the cast device in webCoRE and select the speak() command?


(Craig Bennett) #580

I’m getting a Fetch error

Not Found https://raw.githubusercontent.com/vervallsweg/cast-web-api/master/swagger.json

btw the link you provided at the bottom worked. Thanks. I’m sure you know what I was using it for giving you tested it.


(Thomas) #581

I’m getting the error in the smartthings app

error - bad state. unable to complete page configuration

and in the logs in the ide it says

error grails.validation.ValidationException: Validation Error(s) occurred during save():- Field error in object ‘physicalgraph.device.Device’ on field ‘deviceNetworkId’: rejected value [“ACTUALLY THE MAC OF MY SERVER”]; codes [physicalgraph.device.Device.deviceNetworkId.unique.error.physicalgraph.device.Device.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.error.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.error.java.lang.String,physicalgraph.device.Device.deviceNetworkId.unique.error,device.deviceNetworkId.unique.error.physicalgraph.device.Device.deviceNetworkId,device.deviceNetworkId.unique.error.deviceNetworkId,device.deviceNetworkId.unique.error.java.lang.String,device.deviceNetworkId.unique.error,physicalgraph.device.Device.deviceNetworkId.unique.physicalgraph.device.Device.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.java.lang.String,physicalgraph.device.Device.deviceNetworkId.unique,device.deviceNetworkId.unique.physicalgraph.device.Device.deviceNetworkId,device.deviceNetworkId.unique.deviceNetworkId,device.deviceNetworkId.unique.java.lang.String,device.deviceNetworkId.unique,unique.physicalgraph.device.Device.deviceNetworkId,unique.deviceNetworkId,unique.java.lang.String,unique]; arguments [deviceNetworkId,class physicalgraph.device.Device,“ACTUALLY THE MAC OF MY SERVER”]; default message [{0} must be unique]
@line 125 (addDevices)


(Tobias) #582

Dude… I told you to replace /master/ with /v1.1.0/ resulting url:
https://raw.githubusercontent.com/vervallsweg/cast-web-api/v1.1.0/swagger.json
Then click explore.


(Tobias) #583

You have some other api/bridge whatever running on the same “ACTUALLY THE MAC OF MY SERVER” :wink:

Either remove the other device in your ST IDE that has “ACTUALLY THE MAC OF MY SERVER” as DNI or use a different device for cast-web-api.


(Ryan ) #584

Hey everyone,

I am encountering some challenges when installing cast web-api onto my raspi pi running arm7.

I am currently running nodejs version 10.9.0

When I run the install request this is what I receive:
pi@alarmdecoder:~ $ sudo npm install cast-web-api -g
npm WARN engine cast-web-api@1.0.2: wanted: {“node”:">= 6.0.0"} (current: {“node”:“4.2.1”,“npm”:“2.14.7”})
npm WARN engine mdns-js@1.0.1: wanted: {“node”:">= 8.0.0"} (current: {“node”:“4.2.1”,“npm”:“2.14.7”})
/usr/local/bin/cast-web-api -> /usr/local/lib/node_modules/cast-web-api/bin/cast-web-api
cast-web-api@1.0.2 /usr/local/lib/node_modules/cast-web-api
├── http@0.0.0
├── os@0.1.1
├── node-fetch@2.2.0
├── castv2-client@1.2.0
├── minimist@1.2.0
├── debug@2.6.9 (ms@2.0.0)
├── url@0.11.0 (punycode@1.3.2, querystring@0.2.0)
├── chalk@2.4.1 (escape-string-regexp@1.0.5, supports-color@5.5.0, ansi-styles@3.2.1)
├── mdns-js@1.0.1 (semver@5.5.1, debug@3.1.0, dns-js@0.2.1)
├── google-tts-api@0.0.2 (isomorphic-fetch@2.2.1)
└── castv2@0.1.9 (protobufjs@3.8.2)

Then when I try to confirm its running I get this message:

/usr/local/lib/node_modules/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:414:25)
at Object.Module._extensions…js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/usr/local/lib/node_modules/cast-web-api/node_modules/mdns-js/index.js:14:40)
at Module._compile (module.js:435:26)
at Object.Module._extensions…js (module.js:442:10)

Am I not running the correct version of nodejs?


(Tobias) #585

Definetly not:

Have you installed it through apt-get install nodejs? I think the debian repo has an ancient version of node.


(Sean Donaghey) #586

I am having an issue with the Smartapp on a new install. When I go into the discover devices and select all my devices and then select Next, Save, I get an error “Error - bad state. Unable to complete page configuration.” My cast-web-api is v1.0.2, node is v9.11.1. Running on a Raspberry Pi 2 Model B.

I followed this site for setup:


(M Silverman) #587

[spoiler]Hi All,

I am experiencing the same issue with “The cast-web-api doesn’t return it’s MAC address. No devices were added” error.

I can see that in the log file the devices have no MAC attached.

index 3: Media Room speaker, efb4d121cb0085d3c5772d77ee092198

Any idea???[/spoiler]

Turns out the issue is across subnets the MAC cannot be retrieved. Made the Google Home’s and Smartthings Hub on the same VLAN and everything works.


(macmus) #588

I have added API and speaker but when I try to click on it in smartthing app, the whole app is crashing on the phone.
on the relay i see following logs:

2018-09-05T05:15:22.155Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:15:22.160Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:15:22.169Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:15:22.174Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:18:26.786Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:18:26.790Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:18:26.795Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:18:26.803Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:18:26.839Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:18:26.842Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined
2018-09-05T05:18:26.847Z discover(): exception while prcessing service: TypeError: Cannot read property ‘0’ of undefined

When i add the device:

2018-09-05T05:25:12.175Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.createSubscription(): callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}
2018-09-05T05:25:12.183Z dceea7621495f48aa4ca098cb8f58fb9 sendCallBack(): cannot send callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}, error: Error: connect ECONNREFUSED 0.0.0.0
2018-09-05T05:25:12.258Z on(“request”): /device/dceea7621495f48aa4ca098cb8f58fb9/subscribe/0.0.0.0:0
2018-09-05T05:25:12.260Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.removeSubscription():
2018-09-05T05:25:12.261Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.createSubscription(): callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}
2018-09-05T05:25:12.267Z dceea7621495f48aa4ca098cb8f58fb9 sendCallBack(): cannot send callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}, error: Error: connect ECONNREFUSED 0.0.0.0


(M Silverman) #589

Did you create a “home group” of speakers? I had a group of 3 speakers connected, and adding this group to the app caused the same error as you.


(macmus) #590

I have groups. I added them initially but then removed after this error.
When i add only Single speaker from google home i got the same error.

I also tried to use single speaker from other room not associated with anything and still same problem.


(Ryan ) #591

i did yes, but still encountered the issues. I followed the website for JS node to force it to get the most recent version. My guess is wipe both and re-install the old?


(macmus) #592

When adding speaker i get:

cast-web-api running at http://192.168.0.26:3001/
2018-09-10T03:14:01.101Z on(“request”): /device
2018-09-10T03:14:11.318Z on(“request”): /device
2018-09-10T03:14:21.555Z on(“request”): /device
2018-09-10T03:14:31.846Z on(“request”): /device
2018-09-10T03:14:42.093Z on(“request”): /device
2018-09-10T03:14:51.005Z on(“request”): /device
2018-09-10T03:15:10.130Z on(“request”): /device/dceea7621495f48aa4ca098cb8f58fb9/subscribe/0.0.0.0:0
2018-09-10T03:15:10.134Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.connect(): host: 192.168.0.135, port: 8009
2018-09-10T03:15:10.371Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.removeSubscription():
2018-09-10T03:15:10.374Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.createSubscription(): callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}
2018-09-10T03:15:10.392Z dceea7621495f48aa4ca098cb8f58fb9 sendCallBack(): cannot send callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}, error: Error: connect ECONNREFUSED 0.0.0.0
2018-09-10T03:15:10.459Z on(“request”): /device/dceea7621495f48aa4ca098cb8f58fb9/subscribe/0.0.0.0:0
2018-09-10T03:15:10.461Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.removeSubscription():
2018-09-10T03:15:10.462Z dceea7621495f48aa4ca098cb8f58fb9 CastDevice.createSubscription(): callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}
2018-09-10T03:15:10.467Z dceea7621495f48aa4ca098cb8f58fb9 sendCallBack(): cannot send callback: {“protocol”:“http:”,“slashes”:true,“auth”:null,“host”:“0.0.0.0:0”,“port”:“0”,“hostname”:“0.0.0.0”,“hash”:null,“search”:null,“query”:null,“pathname”:"/",“path”:"/",“href”:“http://0.0.0.0:0/”}, error: Error: connect ECONNREFUSED 0.0.0.0


#593

I’d suggest using this scrip to install NodeJS. This will allow you to pick whatever version you want. I’m currently running 8.9.4.


(Ryan ) #594

Thanks for this. I uninstalled and reinstalled using this but still encountered challenges. My system was showing the most recent version on the -v command but when installing the cast API it wasn’t recognizing it as the most recent version (4.x.x). Turns out that a phantom file was not uninstalling. I had to check all folders and remove anything node and nodejs related. I found one folder and a couple config files. Once I removed those manually and reinstalled, no more issues.

Thanks everyone for the assistance


(Tobias) #595

Ok is there any other bridge/api application installed on the same raspberry pi? Any other software that you’re using with ST on the same raspberry pi?

Otherwise you’ll need to go into the ide, copy some logs during setup and post them here :+1:


(Tobias) #597

Are all the values like host/port 0? Or did you replace the values for privacy?

These values are normal, you can just ignore them :slight_smile: