adeptive / soundtouch-nodejs Goto Github PK
View Code? Open in Web Editor NEWBose SoundTouch Node JS API
License: Apache License 2.0
Bose SoundTouch Node JS API
License: Apache License 2.0
Hello,
I have a problem with homebridge-soundtouch. I think that is basing on SoundTouch-NodeJS, right?
That plugin is crashing since new firmware for SoundTouch 20 was released (FW 20.0.6)).
Log:
Nov 23 06:43:01 Server homebridge[28366]: /usr/lib/node_modules/homebridge-soundtouch/node_modules/soundtouch/api.js:67
Nov 23 06:43:01 Server homebridge[28366]: var isAlive = json.nowPlaying.source != SOURCES.STANDBY;
Nov 23 06:43:01 Server homebridge[28366]: ^
Nov 23 06:43:01 Server homebridge[28366]: TypeError: Cannot read property 'source' of undefined
Nov 23 06:43:01 Server homebridge[28366]: at /usr/lib/node_modules/homebridge-soundtouch/node_modules/soundtouch/api.js:67:40
Nov 23 06:43:01 Server homebridge[28366]: at /usr/lib/node_modules/homebridge-soundtouch/node_modules/soundtouch/api.js:363:17
Nov 23 06:43:01 Server homebridge[28366]: at IncomingMessage.<anonymous> (/usr/lib/node_modules/homebridge-soundtouch/node_modules/soundtouc h/utils/xmltojson.js:25:13)
Nov 23 06:43:01 Server homebridge[28366]: at emitNone (events.js:111:20)
Nov 23 06:43:01 Server homebridge[28366]: at IncomingMessage.emit (events.js:208:7)
Nov 23 06:43:01 Server homebridge[28366]: at endReadableNT (_stream_readable.js:1064:12)
Nov 23 06:43:01 Server homebridge[28366]: at _combinedTickCallback (internal/process/next_tick.js:139:11)
Nov 23 06:43:01 Server homebridge[28366]: at process._tickCallback (internal/process/next_tick.js:181:9)
Nov 23 06:43:01 Server systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Nov 23 06:43:01 Server systemd[1]: homebridge.service: Unit entered failed state.
Nov 23 06:43:01 Server systemd[1]: homebridge.service: Failed with result 'exit-code'.
Hi
First of all, your node is really great, I can finally send direct orders to my bose Soundtouch.
The only problem I have, is to change the music from spotify. it crashes when i send the parameters.
I got this error:
Selecting to play new music source
/home/pi/SoundTouch-NodeJS/api.js:368
handler(json);
^
TypeError: handler is not a function
at Request._callback (/home/pi/SoundTouch-NodeJS/api.js:368:9)
at Request.self.callback (/home/pi/SoundTouch-NodeJS/node_modules/request/request.js:186:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request. (/home/pi/SoundTouch-NodeJS/node_modules/request/request.js:1163:10)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at IncomingMessage. (/home/pi/SoundTouch-NodeJS/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:260:16)
at emitNone (events.js:72:20)
My URL sent is
http://10.10.22.52:5006/diningroom/select/SPOTIFY/*****/spotify:track:4TfnvCrnjbXYu8XrjC4yF1
but it crashes all the time. I have a reaction on the Ipad that want to change the song but the node crashes and nothing happen.
Do you have an idea from what it could be ?
Thank you
Had trouble with the select API call because of the missing 'type' property. Will submit a PR for the fix I used.
When trying to run the sample.js file, it crash
node sample.js
Started Searching...
Lifestyle --> 192.168.1.12
/Users/jaumard/Downloads/test/node_modules/soundtouch/api.js:266
if (json.nowPlayingUpdated != undefined) {
^
TypeError: Cannot read property 'nowPlayingUpdated' of undefined
at SoundTouchAPI.socketUpdate (/Users/jaumard/Downloads/test/node_modules/soundtouch/api.js:266:13)
at WebSocketConnection.<anonymous> (/Users/jaumard/Downloads/test/node_modules/soundtouch/api.js:253:21)
at emitOne (events.js:96:13)
at WebSocketConnection.emit (events.js:191:7)
at WebSocketConnection.processFrame (/Users/jaumard/Downloads/test/node_modules/websocket/lib/WebSocketConnection.js:547:26)
at /Users/jaumard/Downloads/test/node_modules/websocket/lib/WebSocketConnection.js:321:40
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
server.js crashes when trying to select a STORED_MUSIC with the following error messages:
SoundTouch-NodeJS/api.js:382
handler(json);
^
TypeError: handler is not a function
at Request._callback (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/api.js:382:9)
at Request.self.callback (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/node_modules/request/request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/node_modules/request/request.js:1163:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
What I sent was:
localhost:5006/Office/select/STORED_MUSIC/55076f6e-6b79-1d65-a4eb-00089bea8bd7%2F0/0%241%2417%243338%2421161
I got the information out of:
OW PLAYING UPDATED { nowPlaying:
{ deviceID: '08DF1F1A065C',
source: 'STORED_MUSIC',
sourceAccount: '55076f6e-6b79-1d65-a4eb-00089bea8bd7/0',
ContentItem:
{ source: 'STORED_MUSIC',
location: '0$1$17$3338$21001',
sourceAccount: '55076f6e-6b79-1d65-a4eb-00089bea8bd7/0',
isPresetable: 'true',
itemName: 'Bla bla' }
....
So I urlencoded the sourceAccount value
and the location
to the above mentioned REST call.
Interestingly I saw by using the sample.js
NOW SELECTION UPDATED { preset:
{ id: '0',
ContentItem:
{ source: 'STORED_MUSIC',
type: '55076f6e-6b79-1d65-a4eb-00089bea8bd7/0',
location: 'function %28json%29 {\n res.json%28json%29;\n }',
sourceAccount: '0$1$17$3338$21161',
isPresetable: 'true',
itemName: 'Select using API' } } }
NOW PLAYING UPDATED { nowPlaying:
{ deviceID: '08DF1F1A065C',
source: 'INVALID_SOURCE',
ContentItem: { source: 'INVALID_SOURCE', isPresetable: 'true' } } }
Powered On
Not playing
As it looks some source code is passed into the REST call (see location
). The sourceAccount
while decoded correctly was displayed in type
. So I guess something is beeing mixed up.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.