Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community

    Hello, i'm actually trying to run the application on a Raspberry PI. The server starts well but when i invoke the 'play' command the application crashes (but the music start...). Could you help me please ?

    logs :
    0 verbose cli [
    0 verbose cli '/home/pi/.nvm/versions/node/v15.3.0/bin/node',
    0 verbose cli '/home/pi/.nvm/versions/node/v15.3.0/bin/npm',
    0 verbose cli 'start'
    0 verbose cli ]
    1 info using npm@7.0.14
    2 info using node@v15.3.0
    3 timing config:load:defaults Completed in 12ms
    4 timing config:load:file:/home/pi/.nvm/versions/node/v15.3.0/lib/node_modules/npm/npmrc Completed in 3ms
    5 timing config:load:builtin Completed in 3ms
    6 timing config:load:cli Completed in 9ms
    7 timing config:load:env Completed in 1ms
    8 timing config:load:file:/home/pi/node-sonos-http-api/.npmrc Completed in 1ms
    9 timing config:load:project Completed in 3ms
    10 timing config:load:file:/home/pi/.npmrc Completed in 1ms
    11 timing config:load:user Completed in 1ms
    12 timing config:load:file:/home/pi/.nvm/versions/node/v15.3.0/etc/npmrc Completed in 0ms
    13 timing config:load:global Completed in 1ms
    14 timing config:load:cafile Completed in 0ms
    15 timing config:load:validate Completed in 0ms
    16 timing config:load:setUserAgent Completed in 3ms
    17 timing config:load:setEnvs Completed in 4ms
    18 timing config:load Completed in 38ms
    19 verbose npm-session cea9cd7dfbebc89c
    20 timing npm:load Completed in 75ms
    21 timing command:run-script Completed in 37301ms
    22 timing command:start Completed in 37312ms
    23 verbose stack Error: command failed
    23 verbose stack at ChildProcess.<anonymous> (/home/pi/.nvm/versions/node/v15.3.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
    23 verbose stack at ChildProcess.emit (node:events:376:20)
    23 verbose stack at maybeClose (node:internal/child_process:1055:16)
    23 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
    24 verbose pkgid sonos-http-api@1.6.0
    25 verbose cwd /home/pi/node-sonos-http-api
    26 verbose Linux 5.4.72-v7+
    27 verbose argv "/home/pi/.nvm/versions/node/v15.3.0/bin/node" "/home/pi/.nvm/versions/node/v15.3.0/bin/npm" "start"
    28 verbose node v15.3.0
    29 verbose npm v7.0.14
    30 error code 1
    31 error path /home/pi/node-sonos-http-api
    32 error command failed
    33 error command sh -c node server.js
    34 verbose exit 1

    Jimmy Shimizu
    @John-Jood try running it under node 14 to see if it is a node 15 specific error.

    @jishi Thanks for your answer. I downgraded to 14.0.0 and the problem is still there

    nvm ls :

    -> v14.0.0
    default -> 9.0.0 (-> v9.0.0)
    iojs -> N/A (default)
    unstable -> N/A (default)
    node -> stable (-> v15.3.0) (default)
    stable -> 15.3 (-> v15.3.0) (default)
    lts/* -> lts/fermium (-> N/A)
    lts/argon -> v4.9.1 (-> N/A)
    lts/boron -> v6.17.1 (-> N/A)
    lts/carbon -> v8.17.0 (-> N/A)
    lts/dubnium -> v10.23.0 (-> N/A)
    lts/erbium -> v12.20.0 (-> N/A)
    lts/fermium -> v14.15.1 (-> N/A)

    Jimmy Shimizu
    @John-Jood the output doesn't give me any good reason why it is exiting. You need to run it with NODE_LOG_LEVEL=trace npm start and give me the last part of the log just before the crash.

    @jishi here it is :

    2020-11-29T10:35:29.469Z DEBUG resuming all players
    2020-11-29T10:35:34.517Z DEBUG invoking play
    2020-11-29T10:35:34.518Z TRACE urn:schemas-upnp-org:service:AVTransport:1#Play <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><Speed>1</Speed></u:Play></s:Body></s:Envelope>
    2020-11-29T10:35:34.574Z TRACE status code: 200
    2020-11-29T10:35:34.959Z TRACE <Event xmlns="urn:schemas-upnp-org:metadata-1-0/AVT/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/"><InstanceID val="0"><TransportState val="PLAYING"/><CurrentPlayMode val="REPEAT_ALL"/><CurrentCrossfadeMode val="0"/><NumberOfTracks val="1"/><CurrentTrack val="1"/><CurrentSection val="0"/><CurrentTrackURI val="x-sonos-spotify:spotify:track:02kDW379Yfd5PzW5A6vuGt?sid=9&flags=0&sn=1"/><CurrentTrackDuration val="0:03:15"/><CurrentTrackMetaData val="<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1"><res duration="0:03:15">x-sonos-spotify:spotify:track:02kDW379Yfd5PzW5A6vuGt?sid=9&amp;flags=0&amp;sn=1</res><upnp:albumArtURI>https://i.scdn.co/image/ab67616d0000b273d46a8fffbe6c8630784f04da</upnp:albumArtURI><upnp:class>object.item.audioItem.musicTrack</upnp:class><dc:title>Lemonade</dc:title><dc:creator>Internet Money</dc:creator><upnp:album>Lemonade (feat. Gunna, Don Toliver &amp; NAV)</upnp:album></item></DIDL-Lite>"/><r:NextTrackURI val=""/><r:NextTrackMetaData val="<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" parentID="-1"><res></res><upnp:albumArtURI></upnp:albumArtURI><upnp:class>object.item.audioItem.musicTrack</upnp:class><dc:title>Goosebumps</dc:title><dc:creator>HVME</dc:creator><upnp:album>Goosebumps</upnp:album></item></DIDL-Lite>"/><r:EnqueuedTransportURI val=""/><r:EnqueuedTransportURIMetaData val="<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="" parentID="-1" restricted="true"><dc:title>Hits du Moment</dc:title><upnp:class>object.container.playlistContainer</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-0-Token</desc><upnp:albumArtURI></upnp:albumArtURI></item></DIDL-Lite>"/><PlaybackStorageMedium val="NETWORK"/><AVTransportURI val="x-rincon-queue:RINCON_7828CAE6616E01400#vli"/><AVTransportURIMetaData val="<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/&quot; xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="spotify" parentID="0" restricted="false"><dc:title>Spotify</dc:title><upnp:class>object.item.audioItem.linein</upnp:class><res protocolInfo="x-sonos-vli::audio:">x-sonos-vli:RINCON_7828CAE6616E01400:2,spotify:ab7bc1d44ce416fc45f0721593b4656b</res><v

    cookie="10" group=""></vli></item></DIDL-Lite>"/><CurrentTransportActions val="Set, Stop, Pause, Play, X_DLNA_SeekTime, Next, Previous"/><r:CurrentValidPlayModes val="SHUFFLE,REPEAT,REPEATONE"/><r:MuseSessions val=""/><r:DirectControlClientID val="spotify.connect.adapter"/><r:DirectControlIsSuspended val="0"/><r:DirectControlAccountID val=""/></InstanceID></Event>
    2020-11-29T10:35:34.992Z DEBUG Updated playback state in notification handler
    2020-11-29T10:35:35.010Z DEBUG No such service x-sonos-spotify:spotify:track:02kDW379Yfd5PzW5A6vuGt?sid=9&flags=0&sn=1
    track.duration = parseTime((item.res.$attrs || item.res).duration);

    TypeError: Cannot read property '$attrs' of undefined
    at EventEmitter.<anonymous> (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/models/Player.js:99:44)
    at EventEmitter.emit (events.js:315:20)
    at EventEmitter.emit (domain.js:485:12)
    at SAXStream.onCloseTag (/home/pi/node-sonos-http-api/node_modules/xml-flow/lib/xml-flow.js:131:15)
    at SAXStream.emit (events.js:315:20)
    at SAXStream.EventEmitter.emit (domain.js:485:12)
    at SAXParser.me._parser.<computed> [as onclosetag] (/home/pi/node-sonos-http-api/node_modules/sax/lib/sax.js:258:17)
    at emit (/home/pi/node-sonos-http-api/node_modules/sax/lib/sax.js:640:35)
    at emitNode (/home/pi/node-sonos-http-api/node_modules/sax/lib/sax.js:645:5)
    at closeTag (/home/pi/node-sonos-http-api/node_modules/sax/lib/sax.js:905:7)
    at SAXParser.write (/home/pi/node-sonos-http-api/node_modules/sax/lib/sax.js:1449:13)
    at SAXStream.write (/home/pi/node-sonos-http-api/node_modules/sax/lib/sax.js:239:18)
    at Readable.ondata (_stream_readable.js:707:22)
    at Readable.emit (events.js:315:20)
    at Readable.EventEmitter.emit (domain.js:485:12)
    at addChunk (_stream_readable.js:296:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Readable.push (_stream_readable.js:213:10)
    at Immediate.<anonymous> (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/helpers/streamer.js:12:18)
    at processImmediate (internal/timers.js:456:21)
    at process.topLevelDomainCallback (domain.js:137:15)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! sonos-http-api@1.6.0 start: node server.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the sonos-http-api@1.6.0 start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR! /home/pi/.npm/_logs/2020-11-29T10_35_35_075Z-debug.log

    Jimmy Shimizu
    @John-Jood you are running an outdated version, try running the latest master. That sounds like a familiar bug that should have been fixed. Don't forget to reinstall the dependencies after upgrading.
    @jishi You are right. I got a custom fork of Node-Sonos-http-api on Chris Campbell's Qrocodile. I'm afraid it could be outdated. Did you have any feedback on it ?
    (i confirm i made a fresh installation from the last version and it works :/)
    Jimmy Shimizu
    Most of the work is done in the underlying library, so you should be fine with referencing the latest sonos-discovery in package.json, here https://github.com/jishi/node-sonos-http-api/blob/master/package.json#L25
    And then run npm install again
    @jishi It works ! Thanks a lot for your help !
    Hey @jishi i know you dont have a move, but... my move has sort of disappeared? When i call for its state i get a response, but it’s wrong. And when i try to do anything else via the api, it times out. Any thoughts?
    Jimmy Shimizu
    @jasonthefirst_twitter does it frequently change IP? I'm assuming you can still control it via the sonos app. The api might not handle IP changes fully seamlessly, and those should be rare (since otherwise sonos in itself will be sad), if you have any means of logging the IP used by the move over time, that would help. In the meantime, a restart of the api should probably suffice.
    Yeah app still works. Ive tried restarting with no luck. Ill try giving the Move a static IP, maybe that will help.
    Yeah i think that did the trick. Weird! Sorry ro bother you, love love love your work!
    Jimmy Shimizu
    Super strange, but glad it got sorted out.
    @John-Jood I am also trying to run Chris Campbell's Qrocodile project, and having issues playing from Spotify (many of the commands work fine, but not all). Did you modify anything else besides the line in the package file mentioned above?
    @bayratt For the moment i only tested "play/pause" command (which works) and didn't have the time to test the other ones. I'll keep you posted if i face any issues
    Hey @jishi perhaps I spoke too soon. Now the Move is fine, but a couple of my other speakers (One SLs) are behaving weirdly. Seems like it's just timing out when I make a request to two of my six rooms. The error looks like this: {"status":"error","error":"connect ETIMEDOUT","stack":"Error: connect ETIMEDOUT\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)"}
    Ive restarted the API and the machine on which it's running... nothing changes. Any advice would be appreciated!
    ok wtf seems like re-booting the speakers themselves might fix it? I'm so confused. :/
    ok turns out the restart fixed one speaker. the other still times out. ¯_(ツ)_/¯
    so sorry to spam the chat, but I finally sorted a weird permissions issue and installed the freshest version of node, and that seems to have solved it (for now). fingers crossed!
    Jimmy Shimizu
    @John-Jood I think you should really keep track of the ip-addresses that your sonos gear use, to see if they are constantly changing. Also compare the ips that are timing out with the assigned ips of the players.
    @jishi Are u sure this message wath for me ?
    it was for me. And I will keep an eye on it; I'd been running it as a launch agent but now I've got it running in terminal so I can see the errors more clearly
    and right now, as I'm doing nothing but having the api listen, it's basically cycling through my speakers with this error: WARN resubscribing to sid null failed
    Error: connect ETIMEDOUT
    the IP address stays the same for a few timeouts, then it seems to pick a new one
    Jimmy Shimizu
    @jasonthefirst_twitter but does any of your players actually have
    Yeah it did, I had made the IP static. But then I took that off, it was assigned a new one, and the API kept calling the old IP. restarted the API, and now I'm getting a new error: Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control\n at Object.invoke (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)\n at Player.play (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/models/Player.js:446:15)\n at promise.then (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/prototypes/SonosSystem/applyPreset.js:153:46)\n at processTicksAndRejections (internal/process/task_queues.js:86:5)"}
    idk man, things were working smoothly for so long and then things got weird. maybe around the time I added a sub to the system? tho not sure how that would mess things up. do you generally suggest ppl put all the speakers on static IP, or does that not usually make a difference?
    Jimmy Shimizu
    @jasonthefirst_twitter it normally doesn't make a difference, and a healthy network shouldn't change ip-addresses at all if the devices are constantly powered on. I don't see how a sub would affect anything. I would be surprised if the system works flawlessly outside of this api...
    it mostly does. Every once in a while a speaker will be missing from the Sonos app or AirPlay, but pretty infrequently. Have you noticed any difference if the system is wired?
    Hello all! I am having an issue with setting up macOS say command- I have inserted {"macSay": {
    "Voice" : "Joana"
    sorry, early send- I have inserted that following the 'var settings' section, but I am not sure if that is the correct place to put it, as it isn't changing from the default google voice
    Luke Nukem
    hello there, i am trying to use this wonderful thing on a raspberry with Homebridge. i am able to download, install and start the service, but as soon as i close the terminal, the service is shutdown. how can i avoid this? thank you in advance
    @lukenukemmp3_twitter there are many different ways, one of them is to have it run as a service. Google "systemd service" for example.
    Jimmy Shimizu
    Easiest might be to use pm2, it has options to install the systemd service and keep track of which node.js apps that you have started.
    @wasfret_twitter did you put that in settings.json? Also, voice is lower case, and Joana might not be a valid voice name on macos
    Luke Nukem
    @lnguyenh thank you very much! but there is another issue. I dont use homebridge in its native form, but a HOOBS-Installation instead. Everytime i reboot the system, the directory "/node-sonos-http-api-master" is automatically deleted, so there is no .js to start. Sorry for the massive noobness.
    @jishi I did, I will try messing with the case. thanks!
    Owain Williams
    Hi, is it just me or has Spotify removed the URI lookup? I can't seem to get it to work anymore this returns a success message but nothing actually plays or shows in my queue
    1 reply
    @jishi Hi Jishi, i've got an issue while trying to read Playlists on Spotify with or even
    Can you please help me with this issue ?
    I face the following issue :
    {"status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control\n at Object.invoke (/home/pi/Developer/node-sonos-http-api/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)\n at Player.trackSeek (/home/pi/Developer/node-sonos-http-api/node_modules/sonos-discovery/lib/models/Player.js:552:15)\n at /home/pi/Developer/node-sonos-http-api/lib/actions/spotify.js:38:56\n at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
    hello! I'm having trouble getting the node to load my settings.json file
    should I delete the settings.js file? everything starts up fine but it isn't accepting my macSay addition or my spotify keys for search
    I'm running this on a mac, I should mention. my settings.json file reads like this-
    and it is in the root directory of the server