This page last changed on Oct 01, 2014 by itchako.


followed the sonos integration howto and it works like expected for play, pause, next, prev, etc...

But I need support for the state/sensor to output e.g. the artist's name to a label.

What I did:

a) verified that the http://localhost:5005/"sonos player name"/state brings back the state structure like described and it works fine.

b) Created a command to get this state in OR designer, with the Http line from a) and a GET as http-method. Now I understand it is necessary to use a JSON path property to select the information for the label text.

As I am a rookie with node.js this means to me: Add "$.currentTrack.artist" (without ") into the JSON Path expression input, and hope that it gets filled with the artists name...

c) Then I created a sensor and assigned the state command from b)

d) Finally I added a label to my OR GUI and selected this sensor.

But the label only shows a "N/A", means it does not work like expected.
Hope that somebody can fill the gap and advise what must be changed to make this working.


Check the log file and see what the http command returns. You might need to increase log level in in WEB-INF/classes folder.

Posted by mredeker at Oct 02, 2014 09:23


thanks for the hint with the logfile and loglevel change.

Confirmed that the state answer was correct but I could test and check the JSON path statements. One can see very clear if there is an error or not.

I tried several JSON path entries but ended up with $.currentTrack.artist again.

But only when I add a polling interval value, e.g. 3s, it works....!


Posted by itchako at Oct 02, 2014 10:59

Following on from this I am in touch with the guy who wrote the Sonos nodejs function which you are using. One of the issues is that if you are listening to a radio stream it does pull back the relevant data from Station name or what's playing.

This is what he has told me:

The What's playing part is different between radio and regular music streams, as you have noticed. I haven't really figured out what would be the best approach here, see this discussion:


Is it possible to do something like this in openremote (psuedo code)?

currentlyPlaying = $.playerState.currentTrack.Title || $.playerState.currentTrack.Radiostation

Or have conditionals at all, like, "if radiostation, read property x, otherwise use property y"?

Is someone able to give me the answer to these questions so I can get back to him?? Thanks

Posted by jules_bike at Nov 06, 2014 20:37
Document generated by Confluence on Jun 05, 2016 09:39