Code Monkey home page Code Monkey logo

cast-web-api's People

Contributors

ameer1234567890 avatar c99koder avatar kevireilly avatar naresaservice avatar sphr2k avatar vervallsweg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cast-web-api's Issues

forever = background process

Please clarify for me. If I run $ npm install forever -g that means I do not have to re-run the cast-web-api command when windows restarts right?

If not, do you know how I can turn the CMD into a batch where it changes directories, and then runs the cast-web-api. the following isnt working.

@echo off

start cmd.exe

cd C:\Users\Bboy\Desktop\cast-web-api-master\cast-web-api-master

cast-web-api

Group Volume

Hi,

First of all I'd like to say Thank You for the Cast Web API! That's so Awesome to have it!
I'd like to share what I've faced up for the last time, to improve it.
Something strange happens, I can't set volume to the Cast Group anymore. Im pretty sure that it worked before. Even when I want to Speak Text from WebCore to be announced with Group, it doesn't work.

Best Regards,
Alex

TypeError: Cannot read property 'playerState' of undefined

When I'm trying to use the /setMediaPlayback i get error 500 and on the server I get Exception caught: TypeError: Cannot read property 'playerState' of undefined.
I can hear my chromecast trying to connect and can see the stream image for a second before it seems to disconnect from the chromecast device (chromecast audio)

Return data immediately

Right now data is returned after a predefined amount of time. The answer probably arrived way earlier already.
Data should be returned as soon as it becomes available.

Generate unique requestIds

Currently requestIds are hardcoded and range from 1-3.

For proper identification unique requestIds should be generated and all request use one of them.

TTS feature (Google or not)

I'm using your project to cast home automation notifications through SmartThings; which work brilliantly.

However, I can't seem to adjust the TTS to something I want. The standard is not quite the right voice for a UK english person and the Google TTS option with the correct language is just too slow to sound correct.

Is there a way to increase the Google TTS speed? I am using the functions through webCoRE like:
Speak text..., Speak... etc. But there is no setting there for TTS speed, nor is there in the settings of the individual cast devices added by Cast-Web.

Document each API route with an example curl

It'd be really helpful if you could provide a single line command to test some of these commands out.

I'm currently trying

curl http://10.0.0.139:3000/setMediaPlayback\?address\=10.0.0.126\&mediaType\=audio/mp3\&mediaUrl\=https%3A%2F%2Farchive.org%2Fdownload%2Ftestmp3testfile%2Fmpthreetest.mp3\&mediaStreamType\=BUFFERED\&mediaTitle\=test\&mediaSubtitle\=test\&mediaImageURL\=https%3A%2F%2Fi.vimeocdn.com%2Fportrait%2F58832_300x300

and having no luck, I'll go dig through the source code to figure out what I'm doing wrong but as both the app and the docs don't give you a good indication of what these values should be I'm not sure, I was able to get the get commands working fine :)

EDIT: it should have been Url not URL.

curl --globoff  "http://10.0.0.139:3000/setMediaPlayback?address=10.0.0.126&mediaType=audio/mp3&mediaUrl=https%3A%2F%2Farchive.org%2Fdownload%2Ftestmp3testfile%2Fmpthreetest.mp3&mediaStreamType=BUFFERED&mediaTitle=test&mediaSubtitle=test&mediaImageUrl=https%3A%2F%2Fi.vimeocdn.com%2Fportrait%2F58832_300x300"

Run api as daemon

Start the API as a daemon, detached from the terminal. Makes installation easier and fixes forevers windows problems from #61.

deviceFriendlyName missing for one device

Using the latest version from Github (cast-web-api version 0.2.2), Google Home, Google Home Mini, NVIDIA Shield and a Cast Group all show up correctly, while my Sony Soundbar HT-NT5 shows up but doesn't have a deviceFriendlyName

[Help wanted] Install with docker on synology?

I'm trying to get this to work on my synology. I tried installing it inside a docker container but it does not work

npm install cast-web-api                                                                                        
▄ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▀ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▀ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▀ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▐ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 
▄ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
▄ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
runTopLevelLifecycles     ▄ ╢████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
npm ERR! Linux 3.10.102                                                                                                                
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "cast-web-api"                                                                
npm ERR! node v4.2.6                                                                                                                   
npm ERR! npm  v3.5.2                                                                                                                   
npm ERR! code ENOSELF                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                                              
npm ERR! Refusing to install cast-web-api as a dependency of itself                                                                    
npm ERR!                                                                                                                               
npm ERR! If you need help, you may report this error at:                                                                               
npm ERR!     <https://github.com/npm/npm/issues>                                                                                       
                                                                                                                                       
npm ERR! Please include the following file with any support request:                                                                   
npm ERR!     /castweb/npm-debug.log                                                                                                    
root@castweb:/castweb# ls                                                                                                              
castWebApi.js  node_modules  npm-debug.log  package.json                                                                               
root@castweb:/castweb# more npm-debug.log                                                                                              
0 info it worked if it ends with ok                                                                                                    
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'install', 'cast-web-api' ]                                                         
2 info using [email protected]                                                                                                                 
3 info using [email protected]                                                                                                               
4 silly loadCurrentTree Starting                                                                                                       
5 silly install loadCurrentTree                                                                                                        
6 silly install readLocalPackageData                                                                                                   
7 silly fetchPackageMetaData cast-web-api                                                                                              
8 silly fetchNamedPackageData cast-web-api                                                                                             
9 silly mapToRegistry name cast-web-api                                                                                                
10 silly mapToRegistry using default registry                                                                                          
11 silly mapToRegistry registry https://registry.npmjs.org/                                                                            
12 silly mapToRegistry uri https://registry.npmjs.org/cast-web-api                                                                     
13 verbose request uri https://registry.npmjs.org/cast-web-api                                                                         
14 verbose request no auth needed                                                                                                      
15 info attempt registry request try #1 at 12:46:56 PM                                                                                 
16 verbose request id 88281f1868c7cb27                                                                                                 
17 verbose etag W/"59a58f1b-2b71"                                                                                                      
18 verbose lastModified Tue, 29 Aug 2017 15:58:19 GMT               
19 http request GET https://registry.npmjs.org/cast-web-api                                                                            
20 http 304 https://registry.npmjs.org/cast-web-api                                                                                    
21 verbose headers { date: 'Sat, 02 Sep 2017 12:46:56 GMT',                                                                            
21 verbose headers   via: '1.1 varnish',                                                                                               
21 verbose headers   'cache-control': 'max-age=300',                                                                                   
21 verbose headers   etag: 'W/"59a58f1b-2b71"',                                                                                        
21 verbose headers   age: '130',                                                                                                       
21 verbose headers   connection: 'keep-alive',                                                                                         
21 verbose headers   'x-served-by': 'cache-dca17727-DCA',                                                                              
21 verbose headers   'x-cache': 'HIT',                                                                                                 
21 verbose headers   'x-cache-hits': '1',                                                                                              
21 verbose headers   'x-timer': 'S1504356416.213087,VS0,VE0',                                                                          
21 verbose headers   vary: 'Accept-Encoding, Accept' }                                                                                 
22 silly get cb [ 304,                                                                                                                 
22 silly get   { date: 'Sat, 02 Sep 2017 12:46:56 GMT',                                                                                
22 silly get     via: '1.1 varnish',                                                                                                   
22 silly get     'cache-control': 'max-age=300',                                                                                       
22 silly get     etag: 'W/"59a58f1b-2b71"',                                                                                            
22 silly get     age: '130',                                                                                                           
22 silly get     connection: 'keep-alive',                                                                                             
22 silly get     'x-served-by': 'cache-dca17727-DCA',                                                                                  
22 silly get     'x-cache': 'HIT',                                                                                                     
22 silly get     'x-cache-hits': '1',                                                                                                  
22 silly get     'x-timer': 'S1504356416.213087,VS0,VE0',                                                                              
22 silly get     vary: 'Accept-Encoding, Accept' } ]                  
23 verbose etag https://registry.npmjs.org/cast-web-api from cache                                                                     
24 verbose get saving cast-web-api to /root/.npm/registry.npmjs.org/cast-web-api/.cache.json                                           
25 silly install normalizeTree                                                                                                         
26 silly loadCurrentTree Finishing                                                                                                     
27 silly loadIdealTree Starting                                                                                                        
28 silly install loadIdealTree                                                                                                         
29 silly cloneCurrentTree Starting                                                                                                     
30 silly install cloneCurrentTreeToIdealTree                                                                                           
31 silly cloneCurrentTree Finishing                                                                                                    
32 silly loadShrinkwrap Starting                                                                                                       
33 silly install loadShrinkwrap                                                                                                        
34 silly loadShrinkwrap Finishing                                                                                                      
35 silly loadAllDepsIntoIdealTree Starting                                                                                             
36 silly install loadAllDepsIntoIdealTree                                                                                              
37 silly rollbackFailedOptional Starting        

Is there a docker container out there that i can use? if not, what am i doing wrong?

Thanks!

Issue Adding Devices

Hello, I'm trying to add devices with your ST app. I've installed the node.js setup exactly as directions (I'm seeing activity logged on the screen). After I enter the IP address with the port number, I hit test and I get a 200 response, which is good. The problem starts when I select the actual device after discovery and try to add it. When I get to this screen, everything is normal on the app:

screenshot_20181029-171505_smartthings

The problem starts after I hit Next. I get a blank screen and if I try hitting save, I get a "Error-bad state. Unable to complete page configuration".

Any idea what I can do to correct this?

Devices missing on /getDevices

Not all devices show up on /getDevices, even with huge timeout (>10s). Worked more reliably with old mdns package than with mdns-js.

Why is that? Timeout still to small, mdns-js bug, or just used incorrectly?

Google TTS 200 character limit

Great addition to the feature-set! I love the TTS feature with all the languages and accents.

However, the 200 character limit is problematic. When it goes over, it doesn't play anything at all.
I suggest that if it gets over 200 characters, that defaults to the usual-non-Google-TTS behaviour to preserve existing functionality.

Problem case:

I have a script that reads the weather in the morning along with some random text to my Google home mini speaker. When enabling the Google TTS feature on that speaker, I now get nothing if the random text + weather combination happens to be over 200 characters.

Validate response / requestId

Right now the API returns data only if it matches the requested type (MEDIA, DEVICE_STATUS).

However the requestId from the response should match the requestId of the request.

google text to speech to Google hOME

Hi,
i succeded to discover my GH and to modifiy volume and pause/play with your cast-web -api . That 's great ! Thanks
but i would like to text-to-speech with a simple curl command and it fails .... :-) .
I tried ( follwing the doc)
curl -H "Content-Type: application/json" -d '[{ {"mediaTitle":"my text","mediaSubtitle": "mytitle "}]' http://{myIPaddress}/device/{MyGHid}/playMedia/
but i go error back : error {}
it seems i need to also set googleTTS':'language-code in the JSON array?
Some example please , is it possible ? it would be very helpful
BR
phil

Cast audio group enhancement

Google cast groups are currently treated the same way as standard cast devices.
To make client side ID easier it should differentiate between Cast devices and audio groups on discovery.
Audio groups are also slower to update their playback state, since the master has to communicate that to other group members. If you call setMediaPlaybackPlay/Pause now on a audio group, it'll return its current state (old state), not wait for the new playback state.

Crash in service_type.js

Here is a stack trace from the console. I don't know what else was happening at the time because I don't think this crash occurred from an action from SmartThings.

I didn't look to see what is going on here but it appears that some string was maybe some string manipulation is going on and something before the substring that was supposed to yield "_tcp" ended up only getting "_tc"

Seems sort of weird though. Maybe something else is going on. Any way, I'll leave it here.

`C:\Users\SomeUser\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\mdns-js\lib\service_type.js:255
throw new Error('protocol must be either "_tcp" or "_udp" but is "' +
^

Error: protocol must be either "_tcp" or "_udp" but is "_tc"
at checkProtocolU (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\mdns-js\lib\service_type.js:255:11)
at exports.ServiceType.fromString (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\mdns-js\lib\service_type.js:116:3)
at new exports.ServiceType (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\mdns-js\lib\service_type.js:31:14)
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\mdns-js\lib\decoder.js:40:27
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\dns-js\lib\dnspacket.js:223:7
at Array.forEach ()
at module.exports.each (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\dns-js\lib\dnspacket.js:221:17)
at module.exports.decodeSection (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\mdns-js\lib\decoder.js:26:10)
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\cast-web-api\node_modules\mdns-js\lib\decoder.js:111:5
at Array.forEach ()`

Improve device discovery

  1. Also return the device's friendly name
  2. Make the JSON array associative, every device should have a description of it's value; ip:ip, port:port, name:name (...), not just 1:ip, 2:port, ...

TTS Using Curl

Hi there,

I've already got the api set up and working with smartthings, but would like to use a bash script on my home server to trigger some TTS alerts without involving smartthings, could anyone give me an example hello world script I can make use of please?

I've tried, but am struggling with the documentation.

Thanks in advance!

Adam

"Broadcast from...." Message, is it configurable?

Just wondered, as everyone probably is, if the Broadcast from message at the begin of broadcasts now is configurable or not? Also, how would I remove my existing Google authorization so that I can use a different account? I tried just inputting another one but it didn't seem to work. it "took" but it still broadcast with the name of the old account.

"root" does not have permission to access the dev dir

The newly added google assistant package requires one dependency to be compiled through node-gyp. This seems to be an issue when installing the package globally.

(sudo) npm install cast-web-api@beta -g

If you're running an older version of node-gyp it'll just loop with the message:

"root" does not have permission to access the dev dir

There's no difference if you're using sudo, open a root shell or try to install as standard user. The proposed fix in the node-gyp issue is to either set the --unsafe-perm flag or not install anything globally.

I believe neither solution is acceptable.

For now I marked the google-assistant package in the v1.1.0 branch as optional. This is pretty much the only reason why v1.1.0 is not released yet. I'm not an npm expert and have no idea what the best solution is here. Maybe @kevireilly can help out, would be much appreciated.

readme typo for get params

in url "comfig" should be "config" 2 times.

From the Readme:

Usage
http://{hostname}/comfig?get={parameter}
http://{hostname}/comfig?set={parameter}&value={value}

Get/set configuration values in JSON

You can set server configuration values by using 'setConfig?param=value'. There should be a corresponding 'getConfig?param' returning the current configuration value.

Clean HTTP status codes

The HTTP status codes should match the functions response, e.g.:

  • 200 on success
  • 400 on wrong parameters
  • 500 if the network response is not as expected

Volume does not match

The volume set through cast-web-api or returned on the device status through cast-web-api do NOT match the volume the device says when you verbally ask it the volume or set it verbally.

For example- I use the API to set it to 50 and then say "OK Google! What is the current volume?" it returns "The volume is currently set to 55%". And it does not scale linearly either.

1 returns 1
5=5
6=7
10=11
20=22
40=44
60=66
80=88
81=89
82=90
83=91
84=92
85=94
86=95
87=96
88=97
89=98
90=99
91=100

Installation instructions and package.json broken

Impossible to run after clean install with npm install cast-web-api.

In order to use npm run cast-web-api package.json needs scripts array. Installation instructions in documentation should reflect that change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.