Giter VIP home page Giter VIP logo

node-sonos-http-api's Introduction

Hi there 👋

node-sonos-http-api's People

Contributors

aaronbieber avatar ashenshugarret avatar brase avatar brjpeters avatar connor-knabe avatar crissmil avatar dohall avatar fehguy avatar garycaldwell avatar goran58 avatar jishi avatar jplourde5 avatar jsiegenthaler avatar kienz avatar klaas avatar lukekarrys avatar maddox avatar markdstjohn avatar matiasgarciaisaia avatar maxrei-dev avatar mgorsk1 avatar michaelcampbell avatar mjbnz avatar pettersamuelsen avatar philhawthorne avatar riemers avatar rkokie avatar smurthas avatar sseiber avatar timotto 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  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

node-sonos-http-api's Issues

Sayall and resume playing - not working with tuneln

Hi,
When using the sayall function while playing a spotify playlist or any other playlist the music stoppes, says what it is supposed to say, and then it resumes playing the playlist. However, when playing a radio channel with tuneln and execute the sayall command the music/radio stoppes and says what it was supposed to say but when done it does not go back to play the radio station that was playing before.... Is this possible to fix?

play mp3 files and radio streams

Hi,
This is more a feature request or general question than an issue.
Is it technically possible to play a mp3 file located on the harddisk or a mp3 radio stream based on the url. The files are not known in the sonos library.
Reason: I try to implement the http api to my home automation control system.
There, I already have a media manager knowing all the local mp3 files and radio stations. Now I would like to play these files or playlists or stations by sending an http API command.

Something like: play uri:
"x-file-cifs%3a2f%2fMEDIASERVER%2fiTunes%2520Music%2fMarc%2520Seales.mp3"
or
"x-rincon-mp3radio://players.creacast.com/creacast/klassik/playlist.pls"

or to put the files directly to the queue and play it by playing the queue.
I appreciate any hint or tipp and thanks a lot for your sonos github projects here.
Regards
Kenny

No command line after running node server.js

Should I see a command prompt to test the server after running node server.js? Seems to just lock up.

pi@raspberrypi ~ $ npm install
npm WARN package.json [email protected] No license field.
pi@raspberrypi ~ $ node server.js
no settings file found, will only use default settings
http server listening on port 5005
loaded presets { test:
{ players: [ [Object] ],
state: 'PLAYING',
favorite: 'Rock',
uri: 'x-rincon-stream:RINCON_0000000000001500',
playMode: 'SHUFFLE',
pauseOthers: true },
rap:
{ players: [ [Object], [Object], [Object], [Object], [Object] ],
state: 'PLAYING',
favorite: 'Rap',
uri: 'x-rincon-stream:RINCON_0000000000001500',
playMode: 'SHUFFLE',
pauseOthers: true },
'pop rap':
{ players: [ [Object], [Object], [Object], [Object], [Object] ],
state: 'PLAYING',
favorite: 'Rap (Pop)',
uri: 'x-rincon-stream:RINCON_0000000000001500',
playMode: 'SHUFFLE',
pauseOthers: true },
rock:
{ players: [ [Object], [Object], [Object], [Object], [Object] ],
state: 'PLAYING',
favorite: 'Rock',
uri: 'x-rincon-stream:RINCON_0000000000001500',
playMode: 'SHUFFLE',
pauseOthers: true } }

unable to get "say" command to work

I know the say function "says" experimental, but I just wanted to give my feedback regarding my results when attempting to utilize that function. I am unable to get the "say" function to work, although the command seems to be properly recognized by the server as seen here:
{ room: 'Living%20Room', action: 'say', value: 'Hello%20Sean' }

Any ideas on how to get this function to work properly? Running Mavericks 10.9.4 on a MacBook Pro Retina here.

Server Hangs On Start

Hi there, I just grabbed the latest version and ran npm install and the server is hanging on start after checking the presets. I tried starting without the preset file but it does the same thing, any thoughts?

Thanks for the help!

error - failed: Address family not supported by protocol.

After installing node I was able to run the server.js file but have yet to successfully test the system. Each time I try to run a test I get the connection error below

pi@raspberrypi ~ $ wget http://localhost:5005/resumeall
--2015-07-29 03:04:03-- http://localhost:5005/resumeall
Resolving localhost (localhost)... 127.0.0.1, ::1
Connecting to localhost (localhost)|127.0.0.1|:5005... failed: Connection refused.
Connecting to localhost (localhost)|::1|:5005... failed: Address family not supported by protocol.

any thoughts?

albumArtURI Format

Is it possible for the "state" response to include the entire "albumArtURI"?

I'm assuming sonos-discovery already acquires this information anyways. And even if I created a script to format the current output of the "state" response to prepend the "albumArtURI" with the "http://:1400" that would not work as I have noticed that the ZP IP address changes occassionally. Not sure why yet as I have not looked into the pattern but regardless the "Associated ZP IP Address" would need to be updated to reflect the current IP address

example"

##Format Example##
http://<Associated ZP IP Address>:1400/getaa?s=1&u=x-sonos-http%3atrack%253a168274267.mp3%3fsid%3d160%26flags%3d32
##Exact Example##
http://10.0.0.105:1400/getaa?s=1&u=x-sonos-http%3atrack%253a168274267.mp3%3fsid%3d160%26flags%3d32

Once again this is meet the requirements for the openremote sensor to display the Album Art Image.

cross domain error

I have install your nice api to sonos on a raspberry, it is working well calling it from a browser in my network with 192.168.0.32:5005/xxx/play.
when I try to call from another web frontend, also running on the rasp, using a small javascript xmlhttprequest get http://192.168.0.32:5005/xxx/play, I get into cross domain trouble: Origin http://192.168.0.32:3000 is not allowed by Access-Control-Allow-Origin.
So I'm trying to find the place in your code to put in the allow-...
I'm very new to rasp, web, html,.. so maybe this is all wrong, but it seems so close to be solved

Crossfade proper use?

Thank you for the fantastic HTTP API! It works really well.

Is there info anywhere about how the crossfade option is supposed to work? If I set it to "on" for the group controller and then I call "favorite" on that controller to switch the currently playing song to a favorite it stops the currently playing song completely before starting the new favorite.

One complicating factor is that I'm trying to do this with a song playing but then switching to a streaming radio station. Maybe that's not supported?

Because the Sonos alarm doesn't let you adjust the fade up time I hacked a fade-up function today using the http API you created that works very well, but I have no idea how to manually hack a crossfade or if it's possible.

Presets

Hi.

I'm about to test the api, but have no knowlegde about sonos atm. So, what I was wondering is if there's somewhere to read up on preset options? I'm not familiar with the x-rincon-stream uri type etc.

Nice work.

Raspberry Pi issue

When attempting to run on the Raspberry Pi under the latest Raspbian, the following error is encountered:

pi@raspi-sonos ~/node-sonos-http-api $ node server.js
binding SSDP to port 2339
discovering all IPs from lo
discovering all IPs from wlan0
relevant IPs { '192.168.1.137': null }
notification server listening on port 3500
no preset file, ignoring...
http server listening on port 5005
scanning for players in ip 192.168.1.137
subscribing to topology 192.168.1.130
using local endpoint 192.168.1.137

/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:215
_this.state.nextTrack.duration = attr().duration.parseTime();
^
TypeError: Cannot call method 'parseTime' of undefined
at /home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:215:58
at parse (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/node_modules/easysax/easysax.js:671:10)
at EasySAXParser.parse (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/node_modules/easysax/easysax.js:142:4)
at updateTransportState (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:238:17)
at Discovery.handleNotification (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/player.js:151:9)
at Discovery.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/sonos.js:282:15)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:883:14
at process._tickCallback (node.js:415:13)

Group Speakers

Hi,

Would it be possible to add a way to group 2 or more speakers together and play simultaneously?

Something like
/[controller]/add/[additional_node]
/controller/remove/[additional_node]

Or is there another easy way to do it?

current track duration is always 0

After installing the latest version (following issues #43) there seems to have an issue with the value of the current track duration: it is always 0
I remember that this duration was 0 when playing a radio stream (tunein) but was correctly set when playing local files or from spotify. Now it's 0 whatever I'm playing.
(note: next track duration value is fine)
Thanks

wrong player/zone states

Since the latest version the player / zone states are not set correctly. They are always in STOPPED.
"zoneState": "STOPPED",
"playerState": "STOPPED",

Also the times do not seem to be set correctly.
"elapsedTime": 0,
"elapsedTimeFormatted": "00:00",

I'm using node v0.10.26.

Error when trying to node server.js - Synology

When trying to node server.js i get det following error
Synology> node server.js
no settings file found, will only use default settings
module.js:338
throw err;
^
Error: Cannot find module '/volume1/Multimedia/Sonos/lib/actions/'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at requirePath (/volume1/Multimedia/Sonos/node_modules/require-fu/lib/index.js:14:22)
at /volume1/Multimedia/Sonos/node_modules/require-fu/lib/index.js:21:9
at Array.forEach (native)
at fuDirectory (/volume1/Multimedia/Sonos/node_modules/require-fu/lib/index.js:20:34)
at /volume1/Multimedia/Sonos/node_modules/require-fu/lib/index.js:25:5
at new HttpAPI (/volume1/Multimedia/Sonos/lib/sonos-http-api.js:28:24)

The folder actions does exist in the place mentioned, and it is containing several files with commands XXXXX.js.

The Node version that is running is as follows 0.12.0-0009.
I downloaded the node-sones-http-api as zip file, transferred from my mac to synology and unpacked before running npm install (works fine) and then typing node server.js in the correct directory. This was all done while being connected to the synology via terminal ssh on my mac.

Problems with absolute URL for albumArtURI

I have problems with absolute URL for albumArtURI. Since this is implemented, the API does not work anymore. Each time the URL ist called the IP address and the port is rewritten in the URL.

1st call - result:

"currentTrack": {
"artist": "",
"title": "x-sonosapi-stream:s14991?sid=254&flags=32",
"album": "",
"albumArtURI": "http://192.168.86.101:1400/getaa?s=1&u=x-sonosapi-stream%3as14991%3fsid%3d254%26flags%3d32",
"duration": 0,
"uri": "x-rincon-mp3radio://br_mp3-bayern3_m.akacast.akamaistream.net/7/442/142692/v1/gnl.akacast.akamaistream.net/br_mp3_bayern3_m"
}

2nd call - result:

"currentTrack": {
"artist": "",
"title": "x-sonosapi-stream:s14991?sid=254&flags=32",
"album": "",
"albumArtURI": "http://192.168.86.101:1400http://192.168.86.101:1400/getaa?s=1&u=x-sonosapi-stream%3as14991%3fsid%3d254%26flags%3d32",
"duration": 0,
"uri": "x-rincon-mp3radio://br_mp3-bayern3_m.akacast.akamaistream.net/7/442/142692/v1/gnl.akacast.akamaistream.net/br_mp3_bayern3_m"
}

3rd call:
"albumArtURI": "http://192.168.86.101:1400http://192.168.86.101:1400http://192.168.86.101:1400/getaa?s=1&u=x-sonosapi-stream%3as14991%3fsid%3d254%26flags%3d32",

And so on.

This happens especially when the URL is called within short intervals.

Presets.json does not accept more than one preset

Hi,

i tried to add more than one preset to presets.json, but if i do so, the program throws an error on start:
2013-12-29T11:30:20.878692+01:00 myserver sonos[22510]: module.js:485
2013-12-29T11:30:20.879028+01:00 myserver sonos[22510]: throw err;
2013-12-29T11:30:20.879292+01:00 myserver sonos[22510]: ^
2013-12-29T11:30:20.880081+01:00 myserver sonos[22510]: SyntaxError: /data/Install/sonos-http/node-sonos-http-api-master/presets.json: Unexpected token :
2013-12-29T11:30:20.880591+01:00 myserver sonos[22510]: at Object.parse (native)
2013-12-29T11:30:20.881154+01:00 myserver sonos[22510]: at Object.Module._extensions..json (module.js:482:27)
2013-12-29T11:30:20.881682+01:00 myserver sonos[22510]: at Module.load (module.js:356:32)
2013-12-29T11:30:20.882226+01:00 myserver sonos[22510]: at Function.Module._load (module.js:312:12)
2013-12-29T11:30:20.882560+01:00 myserver sonos[22510]: at Module.require (module.js:364:17)
2013-12-29T11:30:20.882972+01:00 myserver sonos[22510]: at require (module.js:380:17)
2013-12-29T11:30:20.883292+01:00 myserver sonos[22510]: at http.createServer.res.writeHead.Content-Type (/data/Install/sonos-http/node-sonos-http-api-master/server.js:10:13)
2013-12-29T11:30:20.883660+01:00 myserver sonos[22510]: at Object.cb as oncomplete

My Json:
{
"FFHBad":{
"players": [
{"roomName": "Bad", "volume": 37}
],
"state": "play",
"favorite": "Bayern 3",
"uri": "x-rincon-stream:RINCON_000E58C271D801400",
"playMode": "NORMAL"
}
"Bayern3Kitchen":{
"players": [
{"roomName": "Küche", "volume": 25}
],
"state": "play",
"favorite": "Bayern 3",
"uri": "x-rincon-stream:RINCON_000E58C9DAB601400",
"playMode": "NORMAL"
}
"FFHKitchen":{
"players": [
{"roomName": "Küche", "volume": 25}
],
"state": "play",
"favorite": "Bayern 3",
"uri": "x-rincon-stream:RINCON_000E58C271D801400",
"playMode": "NORMAL"
}
}

Infinite errors logged on network loss

Whenever I move away from the network in where Sonos is, the http-api server starts eternally logging this error messages, making high (~25% just for this process) CPU usage:

{ [Error: bind EADDRNOTAVAIL]
  code: 'EADDRNOTAVAIL',
  errno: 'EADDRNOTAVAIL',
  syscall: 'bind' } 'uuid:RINCON_000E58C0565401400_sub0000000411' '/MediaRenderer/AVTransport/Event'
{ [Error: bind EADDRNOTAVAIL]
  code: 'EADDRNOTAVAIL',
  errno: 'EADDRNOTAVAIL',
  syscall: 'bind' } 'uuid:RINCON_000E58C0565401400_sub0000000414' '/MediaRenderer/RenderingControl/Event'
{ [Error: bind EADDRNOTAVAIL]
  code: 'EADDRNOTAVAIL',
  errno: 'EADDRNOTAVAIL',
  syscall: 'bind' } 'uuid:RINCON_000E58C0565401400_sub0000000413' '/MediaRenderer/GroupRenderingControl/Event'
{ [Error: bind EADDRNOTAVAIL]
  code: 'EADDRNOTAVAIL',
  errno: 'EADDRNOTAVAIL',
  syscall: 'bind' } 'uuid:RINCON_000E58C0565401400_sub0000000412' '/MediaServer/ContentDirectory/Event'

If I start the server in a LAN without any Sonos component, the server would constantly log scanning for players in ip xxx.xxx.xxx.xxx, but without hogging CPU (0% usage).

I've tried replacing the console.log function with a custom one that appends the line in which the message is generated, but couldn't find anything useful. I think I've stashed it, I could try to search for it and update the report, but I'm pretty much sure it didn't say anything useful - or that seemed to me, at least.

Do you have any idea?

TTS doesn't resume TV on Playbar

Hi,
When using TTS 'say' with Playbar while watching/listening to TV it fails to resume afterwards, and needs to be manually set back to TV.

Thanks,
Tom

Autostart Sonos Api in a Raspberry Pi

Hi

First of all I thank you for your effort.

I'm trying to autostart this API on a Raspberry Pi, but have not been successful. I can start it manually
Could you tell me how?

Best regards

Error when trying to set volume: forGroup is not defined

TransportState
{ room: 'BasementOffice', action: 'volume', value: '1' }
current volume 39

/Volumes/Data/Scripts/node-sonos-http-api-master/node_modules/sonos-discovery/lib/sonos.js:620
console.log('setting volume', volumeLevel, 'for Group', forGroup);
^
ReferenceError: forGroup is not defined

won't start on my newl installed raspi

I'm not sure what I'm doing wrong but I've installed to a new raspi (using "npm install") but when I try and run "node server.js" I get the following error. Any help appreciated.

no settings file found, will only use default settings
http server listening on port 5005
no preset file, ignoring...

==== Stack trace ============================================
Security context: 0x4fd34659 <JS Object>#0#
1: parse(aka parse) [/home/pi/node-sonos-http-api/node_modules/sonos-discovery/node_modules/easysax/easysax.js:~403](this=0x4fd08091 <undefined>,xml=0x306c0bd1 <Very long string[1100]>#1#)
2: parse [/home/pi/node-sonos-http-api/node_modules/sonos-discovery/node_modules/easysax/easysax.js:142](this=0x306c1891 <an EasySAXParser>#2#,xml=0x306c0bd1 <Very long string[1100]>#1#)
3: /\* anonymous _/ [/home/pi/node-sonos-http-api/node_modules/sonos-discovery/lib/sonos.js:271](this=0x306c0325 <an IncomingMessage>#3#)
4: emit [events.js:92](this=0x306c0325 <an IncomingMessage>#3#,type=0x3910f03d <String[3]: end)
5: /_ anonymous */ [_stream_readable.js:944](this=0x4fd34701 <JS Global Object>#4#)
6: _tickCallback [node.js:442](this=0x2d87d921 <a process>#5#)
==== Details ================================================
[1]: parse(aka parse) [/home/pi/node-sonos-http-api/node_modules/sonos-discovery/node_modules/easysax/easysax.js:~403](this=0x4fd08091 <undefined>,xml=0x306c0bd1 <Very long string[1100]>#1#)...

There is more to the error if needed.

Add url hook configuration

Add an optional configuration parameter that would receive a JSON state object for common changes.

Maybe additionally have global and optional room filtered url hooks.

Please subscribe and comment if you are interested in this, and describe your use case if possible.

XML encode for OpenRemote

Is it possible to insert a XML-encoding like this:
xmlEntities.encode(nodeValue)

I want to use "absoluteAlbumArtURI" as an OpenRemote-sensor. But the OpenRemote data is stored as XML file. Thus, there are problems with the XML file, if the "&" and other characters are not stored encoded.

How to send status update to other devices?

Hi!

First I want to tell you that your work is really impressive! Great job there!!

I haves more a question than an issue. Could you point me on how to add notification to other devices? What I'm trying to do is to send an http request to update the status in real time.

For example, I have an amp that I can control through a box that send IR codes and that I can trigger through http request. My goal would be that if I start/stop the Sonos player that is hooked to that amp, to send an http request to turn the amp on/off.
How could I add this to your existing code? I've tried to looked into it, but I don't know enough about node to figure it out?
Many thanks for any help!

David

Installation Question

Hi

I hade server.js running fine on my raspberry pi 2. After about one day it stopt and i couldn't run it again.

I thougt it would be best to install everything new. So i reinstalled the raspbian noob pack.

After installation of node / npm i installed node server.js again.

This time it wouldn't run at all. (no settings found)

What do i need for a stable run?

Can someone tell me all the tasks i have to do?

What is the recommended node version? link?

I hope you can help me.

Greetings from Switzerland

setavtransporturi example

Hi all

Does anyone have an example of the SetAVTransportURI REST request working? I'm trying to load a particular mp3 file from a location on the server, but its just not happening. Suspect my URL structure is wrong, but I'm pulling my hair out.

Many thanks.

Rob

Cannot bind SSDP port on OS X (UDP 1901) when occupied by Sonos Controller

After running npm install and node server.js I see the following:

no settings file found, will only use default settings
error:  code=EADDRINUSE, errno=EADDRINUSE, syscall=bind
http server listening on port 5005
no preset file, ignoring...

I switch to my browser and enter in http://localhost:5005/state to get the state of the player, and then terminal outputs what you see here:

sonos-http-error

I guess this has something to do with how my SONOS player is configured. There are multiple players on the same network; I can access the web interface for my network at http://10.0.1.51:1400/status. I don't see anything in the docs on how to interface with my existing system, and I am pretty sure this is the missing link.

I am running node.js 0.12.2 on Max OS X Yosemite.

restore state after say / sayAll

It would be very nice, when the music will continue to play after the announcement. As a alternative it should be possible to restart music with the play/pause- button / http-call. Currently only the say-command is repeated after pressing the button. Skipping the TTS-Track is also not possible.
In addition with sayAll it happens that the playlist after the merge and split is not the same like before the say-command. One playlist wins and is copied to all devices.

Alarm integration?

I have this working nicely with Openremote for home automation. One nice feature for me would be to make use of the alarm feature of sonos to kick off events. For example in the morning turn on the lights when the alarm goes off. Is this feasible? I guess you would need the json STATE to include a field with the Alarm status.

server not starting

I followed the two steps from the readme.md with npm install and node server.js. npm install seems to do everything as expected. executing node server.js throws no error, but afterwards no server is running. it is just coming back to command line input. any idea?

installed on new raspi but wont startup

npm install seemed to have completed with no errors, but when I node server.js this is the response I receive:

pi@raspberrypi ~/node-sonos-http-api $ node server.js
no settings file found, will only use default settings
http server listening on port 5005

module.js:340
    throw err;
          ^
Error: Cannot find module '/home/pi/node-sonos-http-api/lib/actions/'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at requirePath (/home/pi/node-sonos-http-api/node_modules/require-fu/lib/index.js:14:22)
    at /home/pi/node-sonos-http-api/node_modules/require-fu/lib/index.js:21:9
    at Array.forEach (native)
    at fuDirectory (/home/pi/node-sonos-http-api/node_modules/require-fu/lib/index.js:20:34)
    at /home/pi/node-sonos-http-api/node_modules/require-fu/lib/index.js:25:5
    at Object.<anonymous> (/home/pi/node-sonos-http-api/server.js:30:38)

Any ideas?

Upgrade to latest build but wont startup

Hi,

My raspi was working well with sonos till now.

Today I upgraded the node and node-sonos-http-api and I have the following errors:

1.-The server doesn´t autostart. I followed this steps in issue #20 and #44, without success
2.- If I run node server.js I have "no settings file found, will only use default settings"

This is my node -v: v0.12.1

Could you help me?

Best regards

TypeError: Cannot call method 'indexOf' of undefined

I'm almost certain this is going to be something simple I've missed. The server is running great on my laptop from when I installed just to try it out. I'm attempting to run it on another machine and can't get past an error on start. Thanks in advance.

Also, awesome work!

Here is the output of the error:
'''
/Users/ronny/sonos-http/node_modules/sonos-discovery/lib/sonos.js:338
if (attributes.IsZoneBridge || attributes.ChannelMapSet.indexOf('SW,SW
^
TypeError: Cannot call method 'indexOf' of undefined
at /Users/ronny/sonos-http/node_modules/sonos-discovery/lib/sonos.js:338:65
at parse (/Users/ronny/sonos-http/node_modules/sonos-discovery/node_modules/easysax/easysax.js:671:10)
at EasySAXParser.parse (/Users/ronny/sonos-http/node_modules/sonos-discovery/node_modules/easysax/easysax.js:142:4)
at updateZoneState (/Users/ronny/sonos-http/node_modules/sonos-discovery/lib/sonos.js:388:15)
at /Users/ronny/sonos-http/node_modules/sonos-discovery/lib/sonos.js:231:11
at parse (/Users/ronny/sonos-http/node_modules/sonos-discovery/node_modules/easysax/easysax.js:683:10)
at EasySAXParser.parse (/Users/ronny/sonos-http/node_modules/sonos-discovery/node_modules/easysax/easysax.js:142:4)
at IncomingMessage. (/Users/ronny/sonos-http/node_modules/sonos-discovery/lib/sonos.js:286:17)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:919:16
'''

Say command not working

Hello Jishi, Thank you for the hard work on the node js http api.
I use it with openhab for my home automation because the standard songs binding is giving me less functionality so really great !

But i am facing the problem that the say functionality is not working because each time i get prompted for a captcha when i am going to the translate.google.com site.

This because of the many requests my home automation server does to the website.

do you know a workaround for this issue ?

Thank you for the hard work sofar !!!
roy hofman
[email protected]

cannot communicate to dev

hi, after running node server.js I am getting the following:

no settings file found, will only use default settings binding SSDP to port 2319 discovering all IPs from lo0 discovering all IPs from en0 discovering all IPs from awdl0 relevant IPs { '192.168.1.79': null } notification server listening on port 3500 http server listening on port 5005 no preset file, ignoring... scanning for players in ip 192.168.1.79

and then when trying to make a GET on localhost:5005 with /zones,
I am getting this:

node-sonos-http-api/lib/actions/zones.js:2 callback(player.discovery.getZones()); ^ TypeError: Cannot read property 'discovery' of null

any ideas?

incorrect mute state

The following chain of commands gives an incorrect mute status on my system:

1st command:
http://localhost:5005/kitchen/mute
=> http://localhost:5005/kitchen/state gives "mute":true

2nd command:
http://localhost:5005/kitchen/volume/15
=> http://localhost:5005/kitchen/state gives "mute":false, when the sonos controller app correctly shows the room as still muted

I tried with solo room and grouped rooms, same result: changing the volume on a muted room keeps it muted for real but the state method returns 'mute:false'

Any clue? Is it just on my system?

Multiple NIC support

Hi there,

Due to the protocols used by Sonos all devices need to be in the same network subnet.

When there are multiple NICs in a system, "server.js" always uses the first NIC, which is not always the NIC where the Sonos devices are located.

Would it be possible to allow specifying a bind address for server.js in order to make sure it is using the right network?

Crash when (un)muted

When a (group)zone is (un)muted either through Sonos app or through node-sonos-http-api it throws below exception:

/home/pi/node-sonos-http-api-master/node_modules/sonos-discovery/lib/player.js:157
updateMute(event.data);
^
ReferenceError: updateMute is not defined
at Discovery.handleNotification (/home/pi/node-sonos-http-api-master/node_modules/sonos-discovery/lib/player.js:157:9)
at Discovery.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (/home/pi/node-sonos-http-api-master/node_modules/sonos-discovery/lib/sonos.js:282:15)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)

no connection after power failure

If a Sonos participant was unplugged and then reconnected, you can not access to this participant via the API until the node-http-api-sonos server has been restarted. Via the Sonos app it is possible to access this participant. To all other Sonos participants that were not dis- and reconnected, can still be accessed without any problems.

Is it possible to introduce a UPnP reconnect?

I have often the problem that a Sonos participant restarts (empty playlist) and it thus behaves like after a power failure.

Adding a "music service"

This is great! I am also looking for a way to create and add a music service to sonos. This music service would be a server running on my computer to which I can stream sound (any sound!) and to which Sonos would be listening.

Any idea if this could be done? (Not the server part, the tweak Sonos to listen to it!)

Error on http://www.localhost.com:5005/zones

Clean install, fails on both Windows and Linux

/home/niels/sonos/node-sonos-http-api/lib/actions/zones.js:2
callback(player.discovery.getZones());
^
TypeError: Cannot read property 'discovery' of null
at Object.zones (/home/niels/sonos/node-sonos-http-api/lib/actions/zones.js:2:18)
at handleAction (/home/niels/sonos/node-sonos-http-api/lib/sonos-http-api.js:65:28)
at HttpAPI.requestHandler (/home/niels/sonos/node-sonos-http-api/lib/sonos-http-api.js:47:5)
at /home/niels/sonos/node-sonos-http-api/server.js:51:13
at Server.finish (/home/niels/sonos/node-sonos-http-api/node_modules/node-static/lib/node-static.js:109:13)
at finish (/home/niels/sonos/node-sonos-http-api/node_modules/node-static/lib/node-static.js:168:14)
at /home/niels/sonos/node-sonos-http-api/node_modules/node-static/lib/node-static.js:142:17
at Object.oncomplete (fs.js:107:15)

crossfade, shuffle, and repeat state

I noticed that you added crossfade, shuffle, and repeat triggering support in the last version. Are you planning on adding the corresponding "state" for those also. Openremote wont let you create a switch without being able obtain the status/state for the attribute associated with the switch.

sayAll not reversing to initial grouping state

Started out with all units as individuals (no groups) with 3 of them playing different spotify tracks (Bathroom, Kitchen, Gym)

After the sayall command was played, this was what the system returned to.
https://www.dropbox.com/s/hkz76zo1s00qid0/Screenshot%202015-01-10%2018.21.29.png?dl=0

Output from console:
pi@raspberrypi ~/node-sonos-http-api $ node server.js
no settings file found, will only use default settings
http server listening on port 5005
no preset file, ignoring...
Downloading new tts message file: /home/pi/node-sonos-http-api/static/tts/31247917743076daa139d8c8007a2e8705c12b97-en.mp3

Then with a delay this came up:

error in async series when applying backup error on play [ [ 'ungrouping',
'set volume, coordinator',
'setting uri',
'set playmode' ],
[ 'ungrouping',
'set volume, coordinator',
'setting uri',
'set playmode',
'seek',
'trackSeek' ],
[ 'ungrouping',
'set volume, coordinator',
'setting uri',
'set playmode',
'seek',
'trackSeek' ],
[ 'ungrouping',
'set volume, coordinator',
'setting uri',
'set playmode',
'seek' ],
[ 'ungrouping',
'set volume, coordinator',
'setting uri',
'set playmode' ],
[ 'ungrouping',
'set volume, coordinator',
'setting uri',
'set playmode',
'seek',
'trackSeek' ] ]

playpause not working?

Hi I can't seem to get the playpause toggle to work - is there a problem with this command?
Thanks a brilliant tool for home automation well done.

calling the say function?

Hi Jimmy we're loving the TTS function - especially the kids making announcements around the house!

I managed to set up a webform with java script with the following command

window.open("http://192.168.0.3:5005/Living%20Room/say/" + jSay);

This works fine but clearly means it keeps opening brower windows. I also want to try and embed this in openremote. Is there a way to do this is in the background? I am a novice with javascript - I am guessing I need a post or get command??

Album Art URL gets repeatedly appended to

There's some kind of a bug in lib/action/state.js which means that if you keep requesting the state of a zone which is playing a stream of some kind, the Album Art URL gets repeatedly (erroneously) appended to itself, so after a while it can look like this:

May% curl boris.tlyk.eu:5005/kitchen/state
{"currentTrack":{"artist":"","title":"x-sonosapi-stream:s44491?sid=254&flags=32","album":"","albumArtURI":"http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400/getaa?s=1&u=x-sonosapi-stream%3as44491%3fsid%3d254%26flags%3d32","duration":0,"uri":"x-rincon-mp3radio://bbcmedia.ic.llnwd.net/stream/bbcmedia_6music_mf_p?s=1429005507&e=1429019907&h=f4f73492b70c9b0668151a62f347c0da"},"nextTrack":{"artist":"","title":"bbcmedia_6music_mf_q?s=1429005507&e=1429019907&h=a604344f65e40f553630f83b8564d426","album":"","albumArtURI":"http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.99:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400http://10.100.100.71:1400","duration":"0","uri":"x-rincon-mp3radio://bbcmedia.ic.llnwd.net/stream/bbcmedia_6music_mf_q?s=1429005507&e=1429019907&h=a604344f65e40f553630f83b8564d426"},"volume":8,"mute":false,"trackNo":1,"elapsedTime":1895,"elapsedTimeFormatted":"31:35","zoneState":"PLAYING","playerState":"PLAYING","zonePlayMode":{"shuffle":false,"repeat":false,"crossfade":false}}%

Will try and write a fix for this at some point if I get round to it.

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.