Closed Jvigeant1969 closed 8 years ago
It only reads presets from a presets file. I think this project would need some altering to include something like jsonrpc?request=
Actually it already supports on the fly presets. It needs to be urlescaped though, and that preset doesn't look right to me. It should be:
"roomName": "KITCHEN"
Not
"kitchen": "KITCHEN"
Please compare it to a valid example preset. On Dec 28, 2015 23:33, "NovaGL" notifications@github.com wrote:
It only reads presets from a presets file. I think this project would need some altering to include something like jsonrpc?request=
— Reply to this email directly or view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/119#issuecomment-167684328 .
Learn something new everyday, I tried my own and obviously I didn't urlescape it myself so assumed it didn't work.
No feedback, closing.
Hi All, i finally got around to generating a 'preset json' from a voice command and based on feedback from others on this forum i now encode the json before sending the http://localhost:5005/preset/{ JSON } command.
the generated JSON Is :
{ "TVKITCHEN": { "players": [ { "roomName": "TV", "volume": 50 }, { "roomName": "KITCHEN", "volume": 50 } ], "favorite": "jack johnson", "playMode": "SHUFFLE", "pauseOthers": true } }
then i encode it and get :
%7B%20%22TVKITCHEN%22%3A%20%7B%20%20%22players%22%20%20%3A%20%5B%20%7B%20%22roomName%22%3A%20%22TV%22%2C%20%22volume%22%3A%2050%7D%2C%20%7B%20%22roomName%22%3A%20%22KITCHEN%22%2C%20%22volume%22%3A%2050%7D%5D%2C%20%20%22favorite%22%3A%20%22jack%20johnson%22%2C%20%20%22playMode%22%3A%20%22SHUFFLE%22%2C%20%22pauseOthers%22%3A%20true%20%7D%7D%20
the final command sent to my sonos-http server is :
Them message i get back on the Sonos-http server is : error: your preset doesn't contain any players
Does anyone know what i might be doing wrong ? If i take the same JSON and put it in a preset.json file and start the server is works fine.
Any help would be amazing. Cheers Jacques
You are specifying a name which isn't needed since it only expect a single preset. A preset.json file can contain multiple presets and that is the expected syntax for the file, but not for a single preset.
{
"players": [
{
"roomName": "TV",
"volume": 50
},
{
"roomName": "KITCHEN",
"volume": 50
}
],
"favorite": "jack johnson",
"playMode": "SHUFFLE",
"pauseOthers": true
}
Try this example instead.
That worked PERFECTLY... Thanks !!!!
Cheers Jacques
Hello,
I'm writing an Amazon Echo Voice controller that integrates with this amazing project.... So far everything has been working perfectly... ( ie : Play dire straits in the den , or pause the bedroom sonos, etc...)
I'm now trying to create on-the-fly groupings of rooms using the 'preset' function ... What i'm trying to get to is allowing the user to say 'play jack johnson on the den and kitchen sonos' ... At this point i am able to recognize all the components required for this but i'm failing at passing the preset JSON using the < http://localhost:5005/preset/{ JSON } > .
I'm sure i must be doing something wrong in how i'm structuring the HTTP request .... right now i'm trying to pass something like this :
http://localhost:5005/preset/{ "onthefly1": { "players": [ { "den": "TV", "volume": 30}, "kitchen": "KITCHEN", "volume": 25} ], "state": "PLAYING", "favorite": "Dire Straits", "playMode": "NORMAL", "pauseOthers": true }
does anyone have an actual working preset sent as a URL so i can get this use case working.... I'm looking to forward to publishing it once i get a few more usecases working..
Again thanks for this great software. Cheers Jacques