jishi/node-sonos-discovery

Documentation

Closed this issue · 8 comments

IS there any other documentation available other than the two sample projects?

Cheers

jishi commented

Hi, no unfortunately not. Feel free to ask questions and I will try and answer them as soon as possible. This is one of the reasons why I haven't published it as an npm module.

Ok, no probs. I haven't started writing anything yet - I'm just about to start. I might jot a few bits down as I go through then.

A documentation would be really nice. ;)
Sadly the examples don't really have comments either so it is very hard to understand this module.

I don't fully understand what is needed to connect to my sonos.

//[...] bootstrapping code
var discovery = new SonosDiscovery({port: 8080});
console.log(discovery.players);

returns {}

jishi commented

I'm currently rewriting it completely from scratch. Doesn't make sense for me to document it right now since it will be completely different in the next version.

To give you an answer to your problem, you need to wait for the system to discover the players before you'll actually be able to interact with it. If you do like this:

var discovery = new SonosDiscovery();
discovery.on('topology-change', function () {
  console.log(discovery.players);
})

I understand that it isn't super intuitive, the next version will be promised based and a bit more straight forward.

yes I saw a note about the rewrite
do you have the source somewhere (sneak peek)?
any idea when an alpha is available?
I guess it makes little sense to work with this module?

I played around and tried to understand your webclient but gave up.
thx for the snippet, that helps to get started at least.

I am writing a controller for my apartment with different modules and the audio part can wait a bit.
I might just delay it a few weeks and see your progress.

jishi commented

Yes, I have a branch up to date: https://github.com/jishi/node-sonos-discovery/tree/refactor-with-promises

The basic functionality is there, but the more advanced feature aren't implemented. Do note that the branch still contains the old version as well. You can check the test/integration files for implementation examples.

kk will do. thx a lot for your hard work on this.

just played with the new version with success ;) good enough for my first tests