Step by step guide: Sonos integration

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
DomoRies
Posts: 1
Joined: Friday 25 November 2016 23:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Step by step guide: Sonos integration

Postby DomoRies » Saturday 26 November 2016 0:01

Hi al,
Trying to install the program and running npm start i get the following code. What am i doing wrong?
I installed it on my raspberry pi with raspbian jessie
node version 7.2.0
npm version 3.10.9


Code: Select all

[email protected]:~/node-sonos-http-api $ npm start

> [email protected] start /home/pi/node-sonos-http-api
> node server.js

module.js:472
    throw err;
    ^

Error: Cannot find module 'request'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at /home/pi/node-sonos-http-api/node_modules/request-promise/lib/rp.js:26:24
    at Object.<anonymous> (/home/pi/node-sonos-http-api/node_modules/request-promise/lib/rp.js:33:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/services/deezer.js:2:17)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)

npm ERR! Linux 4.4.32-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.2.0
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sonos-http-api package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sonos-http-api
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sonos-http-api
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/node-sonos-http-api/npm-debug.log



Ok it's working now :D
Last edited by DomoRies on Tuesday 13 December 2016 13:54, edited 2 times in total.

josimd
Posts: 34
Joined: Saturday 09 January 2016 20:47
Target OS: -
Domoticz version:
Contact:

Re: Step by step guide: Sonos integration

Postby josimd » Saturday 26 November 2016 21:36

Hi, I'm running domoticz on Synology...somehow it looks like the program hangs after npm starts.... any suggestions?

~# cd node-sonos-http-api
[email protected]_NAS:~/node-sonos-http-api# npm start

> [email protected] start /root/node-sonos-http-api
> node server.js

2016-11-26T19:30:28.418Z INFO no settings file found, will only use default settings
2016-11-26T19:30:34.097Z INFO Presets loaded: { example:
{ players:
[ { roomName: 'WOONKAMER', volume: 10 },
{ roomName: 'STUDEERKAMER', volume: 10 },
{ roomName: 'Office', volume: 10 },
{ roomName: 'Bedroom', volume: 10 },
{ roomName: 'TV Room', volume: 15 } ],
playMode: { shuffle: true, repeat: 'all', crossfade: false },
pauseOthers: false,
favorite: 'My example favorite' } }
2016-11-26T19:30:34.262Z INFO http server listening on port 5005

mabo21
Posts: 5
Joined: Saturday 07 January 2017 18:17
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Step by step guide: Sonos integration

Postby mabo21 » Sunday 08 January 2017 17:09

Hi Holland,
thanks for the great solution! But i have a few issues and hope you can help me in any way... I have done everything you described, but when i start npm i get some errors.

Code: Select all

ash-4.3# npm start

> [email protected] start /volume1/homes/admin/node-sonos-http-api
> node server.js

2017-01-08T14:55:13.489Z INFO no settings file found, will only use default settings
2017-01-08T14:55:14.669Z INFO Presets loaded: { example:
   { players:
      [ { roomName: 'Bathroom', volume: 10 },
        { roomName: 'Kitchen', volume: 10 },
        { roomName: 'Office', volume: 10 },
        { roomName: 'Bedroom', volume: 10 },
        { roomName: 'TV Room', volume: 15 } ],
     playMode: { shuffle: true, repeat: 'all', crossfade: false },
     pauseOthers: false,
     favorite: 'My example favorite' } }
2017-01-08T14:55:15.281Z ERROR Port 5005 seems to be in use already. Make sure the sonos
-http-api isn't
    already running, or that no other server uses that port. You can specify an alternat
ive http port
    with property "port" in settings.json

npm ERR! Linux 3.10.77
npm ERR! argv "[email protected]/Node.js_v4/usr/local/bin/node" "/usr/local/bin/npm" "s
tart"
npm ERR! node v4.4.2
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sonos-http-api package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sonos-http-api
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sonos-http-api
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /volume1/homes/admin/node-sonos-http-api/npm-debug.log
ash-4.3#


Server.js is still running.
Node.js version is 4.4.2
npm version is 4.0.5

Please can you take a look and help me?

Thanks a lot and best,
Mario

mabo21
Posts: 5
Joined: Saturday 07 January 2017 18:17
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Step by step guide: Sonos integration

Postby mabo21 » Sunday 08 January 2017 21:12

I have uninstall everything and started again. Now it runs without issues.

Best,
Mario

mabo21 wrote:Hi Holland,
thanks for the great solution! But i have a few issues and hope you can help me in any way... I have done everything you described, but when i start npm i get some errors.

Code: Select all

ash-4.3# npm start

> [email protected] start /volume1/homes/admin/node-sonos-http-api
> node server.js

2017-01-08T14:55:13.489Z INFO no settings file found, will only use default settings
2017-01-08T14:55:14.669Z INFO Presets loaded: { example:
   { players:
      [ { roomName: 'Bathroom', volume: 10 },
        { roomName: 'Kitchen', volume: 10 },
        { roomName: 'Office', volume: 10 },
        { roomName: 'Bedroom', volume: 10 },
        { roomName: 'TV Room', volume: 15 } ],
     playMode: { shuffle: true, repeat: 'all', crossfade: false },
     pauseOthers: false,
     favorite: 'My example favorite' } }
2017-01-08T14:55:15.281Z ERROR Port 5005 seems to be in use already. Make sure the sonos
-http-api isn't
    already running, or that no other server uses that port. You can specify an alternat
ive http port
    with property "port" in settings.json

npm ERR! Linux 3.10.77
npm ERR! argv "[email protected]/Node.js_v4/usr/local/bin/node" "/usr/local/bin/npm" "s
tart"
npm ERR! node v4.4.2
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sonos-http-api package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sonos-http-api
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sonos-http-api
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /volume1/homes/admin/node-sonos-http-api/npm-debug.log
ash-4.3#


Server.js is still running.
Node.js version is 4.4.2
npm version is 4.0.5

Please can you take a look and help me?

Thanks a lot and best,
Mario

Trigun
Posts: 17
Joined: Wednesday 30 November 2016 12:58
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: Step by step guide: Sonos integration

Postby Trigun » Saturday 21 January 2017 0:43

Hi all,

sorry but I am a complete noob out here.
I really like to use this feature for my domoticz setup but I am not getting any further.
so this is what I did.

>checked that I did have node version 4.0.0
>did the clone
>cd node-sonos-http-api
>sudo npm install --production
>> it installed without any error, assuming that I did the right thing.

but when I enter PM2 start server.js I get the following: command not found.

when I enter: npm start it works perfectly and I even get a page when entering domoticzip:5005

creating a switch is done correctly

But this is where I get stuck.
I have the feeling that I need to setup a config file where I confige the rooms and sonos Ip etc.
but have no idea how to get any further.

I hope someone cn help me out here.

Thanks in advance!


Return to “Show your projects”

Who is online

Users browsing this forum: No registered users and 2 guests