Simplified HTTP API (node.js)



Show first post
This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

43 replies

Userlevel 4
Badge +14
Hi @jishi,

Thanks for the library. I have working with it for a while, trying to understand the code. I am experimenting to build an Angular2 service out of it - with Observables (first experiments on https://github.com/Tommertom/ng2sonos).

I am struggling to understand how you get to all the data from the Sonos system. For example, the AlbumArtUri for a Radio stream. I have put some trackers on the soap.invoke method to see if that returns values, but it doesn't. Where do you get that data from? And how many soap calls are needed to build the Sonossystem data tree (volume, position, etc.)?

Anyway, hope you can indicate where I can find this in the code.

Regards,

Tom


Hi Tom.

Most of the data is actually "evented" from the players, meaning that they do HTTP POST requests to my software with state changes. That's why you don't see them on the soap.invoke calls, because those are mostly explicit calls for action from the user (play, pause, skip change track etc). The only exception to that is the GetPositionInfo call which is used periodically to "sync" the current state, in case it has gotten out of sync. The code that is responsible for handling these requests are the NotificationListener, which emits it and then each player handles their own data to update their state.

You also need to subscribe to the events, in order to make the Sonos players send these requests. This is handled in the Subscriber class.

Hope that helps!
Badge
Hi Jishi

Thank you for your prompt reply. I already suspected (and feared) this would be the case. But now I know, at least I can finally go to sleep :)

Next step is I to figure out how to do the same in angular2, which should be doable.

Regards

Tom
Userlevel 4
Badge +14
Hi Jishi

Thank you for your prompt reply. I already suspected (and feared) this would be the case. But now I know, at least I can finally go to sleep :)

Next step is I to figure out how to do the same in angular2, which should be doable.

Regards

Tom


Looks like you are depending on some chrome native functions for the network traffic. You might already be aware of this, but https://github.com/siboulet/zonos is a chrome implementation of the Sonos network stack that might help you.

However, for maximum flexibility, having a separate server with no networking boundaries would be a lot easier.
Badge

Looks like you are depending on some chrome native functions for the network traffic. You might already be aware of this, but https://github.com/siboulet/zonos is a chrome implementation of the Sonos network stack that might help you.

However, for maximum flexibility, having a separate server with no networking boundaries would be a lot easier.


That indeed looks like an implementation to copy from, which is better than relying on a cordova plugin.

Will post if I got it to work.
Userlevel 2
Hi,
I don't understand how to install this. I Need a step-by-step description for a raspberry Pi with Raspian.
Thank you very much,
Baenker
Badge
Hi Jishi,

Is it possible to move a sub between rooms using the api?

Cheers,
Dave
JIshi, awesome work. I've used and contributed to the github.com/bencevans/node-sonos lib for a few projects. Your lib has come a long way since I first checked it out. I'm going to migrate to it and I'll let you know how it works.

Thanks!
Scott
Man congratulations and thanks for this awesome work.
I just finished integration on my RPI. Actually i added voice control on top of it with Jasper, Sphinx and Google speech API.
This way I can change the current playlist without touching a button.
Next step would be to be able to play a Spotify artist radio on the go. I saw a musicsearch.js action class. Could this achieve what I want ? As it is not documented I'm not sure.

Thanks again for your work man
I just figured out about the "musicsearch" usage. That's awesome...
Hello StarNab. Can I ask you how you got the Spotify musicsearch to work?

And finally for my local library I've found the following commands.
code:
/Playroom/musicsearch/library/song/red+hot+chili+peppers+dark+necessities

This command is a "search" command. It is searching for a song that matches the criteria. The command is working, but it is not that what I want. So I'm looking for a better way to select and play a specific song from my local library.


I would be very happy if you can support me with some hints.

Many thanks
Regards


There is no convenient way to "queue and play" form local library today. It would make sense to support that in the same manner as the music services, I just haven't looked at it. I'll create an issue for it in github and look at it when I get the time. It's a good suggestion.



Hi jishi,
first thanks for your work!
Just read your post from January 2017 and wanted to ask you if there is totay a more or less convenient way to 'queue and play' from a local library?

Best wishes from Cologne