node-sonos-http-api icon indicating copy to clipboard operation
node-sonos-http-api copied to clipboard

Sonos state json update

Open julesbike opened this issue 9 years ago • 1 comments

For some reason the latest Sonos update has changed the state json which might break your code if you are fetching data from it:

The two that messed up my application are zoneplaybackState is now just playbackState and zoneplayMode is now called playMode

{"currentTrack":{"artist":"Classic FM","albumArtUri":"/getaa?s=1&u=x-sonosapi-stream%3as8439%3fsid%3d254%26flags%3d8224%26sn%3d0","duration":0,"uri":"x-sonosapi-stream:s8439?sid=254&flags=8224&sn=0","type":"radio","stationName":"Classic FM","absoluteAlbumArtUri":"http://192.168.0.2:1400/getaa?s=1&u=x-sonosapi-stream%3as8439%3fsid%3d254%26flags%3d8224%26sn%3d0"},"nextTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":""},"volume":14,"mute":false,"trackNo":1,"elapsedTime":308,"elapsedTimeFormatted":"00:05:08","playbackState":"PLAYING","playMode":{"repeat":"none","shuffle":false,"crossfade":false}}

julesbike avatar Dec 12 '16 08:12 julesbike

Yes, this was changed when we moved from 0.x to 1.x version, and was preceeded by a long running beta.

If you still want to use the old version, it still exists as the "legacy" branch, but that will not be maintained.

There is always a tradeoff between conforming to a set format vs moving on to newer, better things. In this case, the old state format had organically grown because of new requirements popping up all the time, and I took the liberty of cleaning it up based on the newfound experience on what one actually might need. I understand that it broke some peoples integrations, but changes are sometimes necessary to move forward.

jishi avatar Dec 12 '16 08:12 jishi