{"id":13825452,"url":"https://github.com/jishi/node-sonos-http-api","last_synced_at":"2025-10-05T03:26:46.185Z","repository":{"id":7493055,"uuid":"8842243","full_name":"jishi/node-sonos-http-api","owner":"jishi","description":"An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.","archived":false,"fork":false,"pushed_at":"2025-03-22T11:45:06.000Z","size":1339,"stargazers_count":1890,"open_issues_count":196,"forks_count":463,"subscribers_count":118,"default_branch":"master","last_synced_at":"2025-09-23T19:28:37.343Z","etag":null,"topics":["nodejs","sonos"],"latest_commit_sha":null,"homepage":"http://jishi.github.io/node-sonos-http-api/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jishi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-03-17T21:54:53.000Z","updated_at":"2025-09-14T18:46:05.000Z","dependencies_parsed_at":"2024-10-15T09:00:39.122Z","dependency_job_id":"6e31fb17-1bd4-4cce-9421-256fc58d9213","html_url":"https://github.com/jishi/node-sonos-http-api","commit_stats":{"total_commits":454,"total_committers":64,"mean_commits":7.09375,"dds":0.4515418502202643,"last_synced_commit":"aac16a5161ffef5721ed88f11901576bcdca7664"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jishi/node-sonos-http-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jishi%2Fnode-sonos-http-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jishi%2Fnode-sonos-http-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jishi%2Fnode-sonos-http-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jishi%2Fnode-sonos-http-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jishi","download_url":"https://codeload.github.com/jishi/node-sonos-http-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jishi%2Fnode-sonos-http-api/sbom","scorecard":{"id":521699,"data":{"date":"2025-08-11","repo":{"name":"github.com/jishi/node-sonos-http-api","commit":"3776f0ee2261c924c7b7204de121a38100a08ca7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":9,"reason":"Found 17/18 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.0.1 not signed: https://api.github.com/repos/jishi/node-sonos-http-api/releases/4350666","Warn: release artifact v1.0.0 not signed: https://api.github.com/repos/jishi/node-sonos-http-api/releases/4303084","Warn: release artifact v1.0.0-beta.16 not signed: https://api.github.com/repos/jishi/node-sonos-http-api/releases/3477048","Warn: release artifact v1.0.1 does not have provenance: https://api.github.com/repos/jishi/node-sonos-http-api/releases/4350666","Warn: release artifact v1.0.0 does not have provenance: https://api.github.com/repos/jishi/node-sonos-http-api/releases/4303084","Warn: release artifact v1.0.0-beta.16 does not have provenance: https://api.github.com/repos/jishi/node-sonos-http-api/releases/3477048"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"33 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T03:10:48.049Z","repository_id":7493055,"created_at":"2025-08-20T03:10:48.049Z","updated_at":"2025-08-20T03:10:48.049Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278403786,"owners_count":25981133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","sonos"],"created_at":"2024-08-04T09:01:21.193Z","updated_at":"2025-10-05T03:26:46.168Z","avatar_url":"https://github.com/jishi.png","language":"JavaScript","funding_links":["https://www.paypal.me/jishi"],"categories":["JavaScript"],"sub_categories":[],"readme":"[![PayPal donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/jishi \"Donate once-off to this project using Paypal\") [![Join the chat at gitter](https://img.shields.io/gitter/room/badges/shields.svg)](https://gitter.im/node-sonos-http-api/Lobby \"Need assistance? Join the chat at Gitter.im\") \n\n⚠WARNING!⚠\n\nThe Sonos S2 update, released June 2020, still works with this API. However, it might break in the future if and when Sonos decide to drop UPnP as the control protocol. \n\n\nFeel free to use it as you please. Consider donating if you want to support further development. Reach out on the gitter chat if you have issues getting it to run, instead of creating new issues, thank you!\n\nIf you are also looking for cloud control (ifttt, public webhooks etc), see the [bronos-client](http://www.bronos.net) project! That pi image also contains an installation of this http-api.  \n\nSONOS HTTP API\n==============\n\n** Beta is no more, master is up to date with the beta now! **\n\n**This application requires node 4.0.0 or higher!**\n\n**This should now work on Node 6+, please let me know if you have issues**\n\nA simple http based API for controlling your Sonos system.\n\nThere is a simple sandbox at /docs (incomplete atm)\n\nUSAGE\n-----\n\nStart by fixing your dependencies. Invoke the following command:\n\n`npm install --production`\n\nThis will download the necessary dependencies if possible.\n\nstart the server by running\n\n`npm start`\n\nNow you can control your system by invoking the following commands:\n\n\thttp://localhost:5005/zones\n\thttp://localhost:5005/lockvolumes\n\thttp://localhost:5005/unlockvolumes\n\thttp://localhost:5005/pauseall[/{timeout in minutes}]\n\thttp://localhost:5005/resumeall[/{timeout in minutes}]\n\thttp://localhost:5005/preset/{JSON preset}\n\thttp://localhost:5005/preset/{predefined preset name}\n\thttp://localhost:5005/reindex\n\thttp://localhost:5005/{room name}/sleep/{timeout in seconds or \"off\"}\n\thttp://localhost:5005/{room name}/sleep/{timeout in seconds or \"off\"}\n\thttp://localhost:5005/{room name}/{action}[/{parameter}]\n\nExample:\n\n`http://localhost:5005/living room/volume/15`\n(will set volume for room Living Room to 15%)\n\n`http://localhost:5005/living room/volume/+1`\n(will increase volume by 1%)\n\n`http://localhost:5005/living room/next`\n(will skip to the next track on living room, unless it's not a coordinator)\n\n`http://localhost:5005/living room/pause`\n(will pause the living room)\n\n`http://localhost:5005/living room/favorite/mysuperplaylist`\n(will replace queue with the favorite called \"mysuperplaylist\")\n\n`http://localhost:5005/living room/repeat/on`\n(will turn on repeat mode for group)\n\n\nThe actions supported as of today:\n\n* play\n* pause\n* playpause (toggles playing state)\n* volume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)\n* groupVolume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)\n* mute / unmute\n* groupMute / groupUnmute\n* togglemute (toggles mute state)\n* trackseek (parameter is queue index)\n* timeseek (parameter is in seconds, 60 for 1:00, 120 for 2:00 etc)\n* next\n* previous\n* state (will return a json-representation of the current state of player)\n* favorite\n* favorites (with optional \"detailed\" parameter)\n* playlist\n* lockvolumes / unlockvolumes (experimental, will enforce the volume that was selected when locking!)\n* repeat (on(=all)/one/off(=none)/toggle)\n* shuffle (on/off/toggle)\n* crossfade (on/off/toggle)\n* pauseall (with optional timeout in minutes)\n* resumeall (will resume the ones that was pause on the pauseall call. Useful for doorbell, phone calls, etc. Optional timeout)\n* say\n* sayall\n* saypreset\n* queue\n* clearqueue\n* sleep (values in seconds)\n* linein (only analog linein, not PLAYBAR yet)\n* clip (announce custom mp3 clip)\n* clipall\n* clippreset\n* join / leave  (Grouping actions)\n* sub (on/off/gain/crossover/polarity) See SUB section for more info\n* nightmode (on/off/toggle, PLAYBAR only)\n* speechenhancement (on/off/toggle, PLAYBAR only)\n* bass/treble (use -10 through to 10 as the value. 0 is neutral)\n\n\nState\n-----\n\nExample of a state json:\n\n\t{\n\t  \"currentTrack\":{\n\t    \"artist\":\"College\",\n\t    \"title\":\"Teenage Color - Anoraak Remix\",\n\t    \"album\":\"Nightdrive With You\",\n\t    \"albumArtURI\":\"/getaa?s=1\u0026u=x-sonos-spotify%3aspotify%253atrack%253a3DjBDQs8ebkxMBo2V8V3SH%3fsid%3d9%26flags%3d32\",\n\t    \"duration\":347,\n\t    \"uri\":\"x-sonos-spotify:spotify%3atrack%3a3DjBDQs8ebkxMBo2V8V3SH?sid=9\u0026flags=32\"\n\t  },\n\t  \"nextTrack\":{\n\t    \"artist\":\"Blacknuss\",\n\t    \"title\":\"Thinking of You\",\n\t    \"album\":\"3\",\n\t    \"albumArtURI\":\"/getaa?s=1\u0026u=x-sonos-spotify%3aspotify%253atrack%253a4U93TIa0X6jGQrTBGTkChH%3fsid%3d9%26flags%3d32\",\n\t    \"duration\":235,\n\t    \"uri\":\"x-sonos-spotify:spotify%3atrack%3a4U93TIa0X6jGQrTBGTkChH?sid=9\u0026flags=32\"\n\t  },\n\t  \"volume\":18,\n\t  \"mute\":false,\n\t  \"trackNo\":161,\n\t  \"elapsedTime\":200,\n\t  \"elapsedTimeFormatted\":\"03:20\",\n\t  \"zoneState\":\"PAUSED_PLAYBACK\",\n\t  \"playerState\":\"PLAYING\",\n\t  \"zonePlayMode\":{\n\t    \"shuffle\":true,\n\t    \"repeat\":false,\n\t    \"crossfade\":false\n\t  },\n\t  \"equalizer\": {\n        \"bass\": 0,\n        \"treble\": 0,\n        \"loudness\": true\n      }\n\t}\n\nQueue\n-----\nObtain the current queue list from a specified player. The request will accept:\n - limit (optional)\n - offset (optional, requires limit)\n - detailed flag (optional, include uri in response)\n\n\t    http://localhost:5005/living room/queue\n\t    http://localhost:5005/living room/queue/10 (only return top 10)\n\t    http://localhost:5005/living room/queue/10/10 (return result 11-20)\n\t    http://localhost:5005/living room/queue/detailed\n\t    http://localhost:5005/living room/queue/10/detailed\n\nExample queue response:\n```\n[\n    {\n      \"albumArtURI\": \"/getaa?s=1\u0026u=x-sonos-spotify%3aspotify%253atrack%253a0AvV49z4EPz5ocYN7eKGAK%3fsid%3d9%26flags%3d8224%26sn%3d3\",\n      \"title\": \"No Diggity\",\n      \"artist\": \"Blackstreet\",\n      \"album\": \"Another Level\"\n    },\n    {\n      \"albumArtURI\": \"/getaa?s=1\u0026u=x-sonos-spotify%3aspotify%253atrack%253a5OQGeJ1ceykovrykZsGhqL%3fsid%3d9%26flags%3d8224%26sn%3d3\",\n      \"title\": \"Breathless\",\n      \"artist\": \"The Corrs\",\n      \"album\": \"In Blue\"\n    }\n]\n\n```\n\n\nPreset\n------\n\nA preset is a predefined grouping of players with predefined volumes, that will start playing whatever is in the coordinators queue.\n\nExample preset (state and uri are optional):\n\n\t{\n\t  \"players\": [\n\t    { \"roomName\": \"room1\", \"volume\": 15},\n\t    {\"roomName\": \"room2\", \"volume\": 25}\n\t  ],\n\t  \"state\": \"stopped\",\n\t  \"favorite\": \"my favorite name\",\n\t  \"uri\": \"x-rincon-stream:RINCON_0000000000001400\",\n\t  \"playMode\": {\n\t    \"shuffle\": true\n\t  },\n\t  \"pauseOthers\": true\n\t  \"sleep\": 600\n\t}\n\nThe first player listed in the example, \"room1\", will become the coordinator. It will loose it's queue when ungrouped but eventually that will be fixed in the future. Playmode defines the three options \"shuffle\", \"repeat\", \"crossfade\" similar to the state\nFavorite will have precedence over a uri.\npauseOthers will pause all zones before applying the preset, effectively muting your system.  sleep is an optional value that enables the sleep timer and is defined in total seconds (600 = 10 minutes).\n\npresets.json (deprecated, use preset files instead)\n-----------\n\nYou can create a file with pre made presets, called presets.json. It will be loaded upon start, any changes requires a restart of the server.\n\nExample content:\n\n```json\n{\n  \"all\": {\n    \"playMode\": {\n      \"shuffle\": true\n    },\n    \"players\": [\n      {\n        \"roomName\": \"Bathroom\",\n        \"volume\": 10\n      },\n      {\n        \"roomName\": \"Kitchen\",\n        \"volume\": 10\n      },\n      {\n        \"roomName\": \"Office\",\n        \"volume\": 10\n      },\n      {\n        \"roomName\": \"Bedroom\",\n        \"volume\": 10\n      },\n      {\n        \"roomName\": \"TV Room\",\n        \"volume\": 15\n      }\n    ],\n    \"pauseOthers\": true\n  },\n  \"tv\": {\n    \"players\": [\n      {\n        \"roomName\": \"TV Room\",\n        \"volume\": 20\n      }\n    ],\n    \"pauseOthers\": true,\n    \"uri\": \"x-rincon-stream:RINCON_000XXXXXXXXXX01400\"\n  }\n}\n```\n\n\nIn the example, there is one preset called `all`, which you can apply by invoking:\n\n`http://localhost:5005/preset/all`\n\n\npresets folder\n--------------\n\nYou can create a preset files in the presets folder with pre made presets. It will be loaded upon start, any changes made to files in this folder (addition, removal, modification) will trigger a reload of your presets. The name of the file (xxxxxx.json) will become the name of the preset. It will be parsed as JSON5, to be more forgiving of typos. See http://json5.org/ for more info.\n\nExample content:\n\n```json\n{\n  \"players\": [\n    {\n      \"roomName\": \"Bathroom\",\n      \"volume\": 10\n    },\n    {\n      \"roomName\": \"Kitchen\",\n      \"volume\": 10\n    },\n    {\n      \"roomName\": \"Office\",\n      \"volume\": 10\n    },\n    {\n      \"roomName\": \"Bedroom\",\n      \"volume\": 10\n    },\n    {\n      \"roomName\": \"TV Room\",\n      \"volume\": 15\n    }\n  ],\n  \"trackNo\": 3,\n  \"elapsedTime\": 42,\n  \"playMode\": {\n    \"shuffle\": true,\n    \"repeat\": \"all\",\n    \"crossfade\": false\n  },\n  \"pauseOthers\": false,\n  \"favorite\": \"My example favorite\"\n}\n```\n\nThere is an example.json bundled with this repo. The name of the file will become the name of the preset.\n\nsettings.json\n-------------\n\nIf you want to change default settings, you can create a settings.json file and put in the root folder. This will be parsed as JSON5, to be more forgiving. See http://json5.org/ for more info.\n\nAvailable options are:\n\n* port: change the listening port\n* ip: change the listening IP\n* https: use https which requires a key and certificate or pfx file\n* auth: require basic auth credentials which requires a username and password\n* announceVolume: the percentual volume use when invoking say/sayall without any volume parameter\n* presetDir: absolute path to look for presets (folder must exist!)\n* household: when theres multiple sonos accounts on one network (example: Sonos_ab7d67898dcc5a6d, find it in [Your sonos IP]:1400/status/zp). Note that the value after the '.' should not be removed. See more info here: https://github.com/jishi/node-sonos-http-api/issues/783\n\n\nExample:\n```json\n\t{\n\t  \"voicerss\": \"Your api key for TTS with voicerss\",\n\t  \"microsoft\": {\n\t    \"key\": \"Your api for Bing speech API\",\n\t    \"name\": \"ZiraRUS\"\n\t  },\n\t  \"port\": 5005,\n\t  \"ip\": \"0.0.0.0\",\n\t  \"securePort\": 5006,\n\t  \"https\": {\n\t    \"key\": \"/path/to/key.pem\",\n\t    \"cert\" : \"/path/to/cert.pem\"\n\n\t    //... for pfx (alternative configuration)\n\t    \"pfx\": \"/path/to/pfx.pfx\",\n\t    \"passphrase\": \"your-passphrase-if-applicable\"\n\t  },\n\t  \"auth\": {\n\t    \"username\": \"admin\",\n\t    \"password\": \"password\"\n\t  },\n\t  \"announceVolume\": 40,\n\t  \"pandora\": {\n\t    \"username\": \"your-pandora-account-email-address\",\n\t    \"password\": \"your-pandora-password\"\n\t  },\n\t  \"spotify\": {\n\t    \"clientId\": \"your-spotify-application-clientId\",\n\t    \"clientSecret\": \"your-spotify-application-clientSecret\"\n\t  },\n\t  \"library\": {\n\t    \"randomQueueLimit\": 50\n\t  }\n\t}\n```\n\nOverride as it suits you.\n\nNote for Spotify users!\n-----------------------\n\nTo use Spotify, go to https://developer.spotify.com/my-applications/#!/applications/create and create a Spotify application to get your client keys. You can name it Sonos or anything else and you don't have to change any values. Use the Client ID and the Client Secret values in the settings.json file as indicated above.\n\n\nFavorites\n---------\n\nIt now has support for starting favorites. Simply invoke:\n\n`http://localhost:5005/living room/favorite/[favorite name]`\n\nand it will replace the queue with that favorite. Bear in mind that favorites may share name, which might give unpredictable behavior at the moment.\n\nPlaylist\n---------\n\nPlaying a Sonos playlist is now supported. Invoke the following:\n\n`http://localhost:5005/living room/playlist/[playlist name]`\n\nand it will replace the queue with the playlist and starts playing.\n\n\nSay (TTS support)\n-----------------\n\nExperimental support for TTS. Today the following providers are available:\n\n* voicerss\n* Microsoft Cognitive Services (Bing Text to Speech API)\n* AWS Polly\n* Google (default)\n* macOS say command\n* Elevenlabs\n\nIt will use the one you configure in settings.json. If you define settings for multiple TTS services, it will not be guaranteed which one it will choose!\n\n#### VoiceRSS\n\nThis REQUIRES a registered API key from voiceRSS! See http://www.voicerss.org/ for info.\n\nYou need to add this to a file called settings.json (create if it doesn't exist), like this:\n\n```\n{\n  \"voicerss\": \"f5e77e1d42063175b9219866129189a3\"\n}\n```\n\nReplace the code above (it is just made up) with the api-key you've got after registering.\n\nAction is:\n\n\t/[Room name]/say/[phrase][/[language_code]][/[announce volume]]\n\t/sayall/[phrase][/[language_code]][/[announce volume]]\n\nExample:\n\n\t/Office/say/Hello, dinner is ready\n\t/Office/say/Hej, maten är klar/sv-se\n\t/sayall/Hello, dinner is ready\n\t/Office/say/Hello, dinner is ready/90\n\t/Office/say/Hej, maten är klar/sv-se/90\n\nlanguage code needs to be before volume if specified.\n\nSayall will group all players, set 40% volume (by default) and then try and restore everything as the way it where. Please try it out, it will probably contain glitches but please report detailed descriptions on what the problem is (starting state, error that occurs, and the final state of your system).\n\nThe supported language codes are:\n\n| Language code | Language |\n| ------------- | -------- |\n| ca-es | Catalan  |\n| zh-cn | Chinese (China) |\n| zh-hk |Chinese (Hong Kong) |\n| zh-tw | Chinese (Taiwan) |\n| da-dk | Danish |\n| nl-nl | Dutch |\n| en-au | English (Australia) |\n| en-ca | English (Canada) |\n| en-gb | English (Great Britain) |\n| en-in | English (India) |\n| en-us | English (United States) |\n| fi-fi | Finnish |\n| fr-ca | French (Canada) |\n| fr-fr | French (France) |\n| de-de | German |\n| it-it | Italian |\n| ja-jp | Japanese |\n| ko-kr | Korean |\n| nb-no | Norwegian |\n| pl-pl | Polish |\n| pt-br | Portuguese (Brazil) |\n| pt-pt | Portuguese (Portugal) |\n| ru-ru | Russian |\n| es-mx | Spanish (Mexico) |\n| es-es | Spanish (Spain) |\n| sv-se | Swedish (Sweden) |\n\n#### Microsoft\nThis one also requires a registered api key. You can sign up for free here: https://www.microsoft.com/cognitive-services/en-US/subscriptions?mode=NewTrials and select \"Bing Speech - Preview\".\n\nThe following configuration is available (the entered values except key are default, and may be omitted):\n\n```json\n\t{\n\t  \"microsoft\": {\n\t    \"key\": \"Your api for Bing speech API\",\n\t    \"name\": \"ZiraRUS\"\n\t  }\n\t}\n```\n\nYou change language by specifying a voice name correlating to the desired language.\nName should be specified according to this list: https://www.microsoft.com/cognitive-services/en-us/speech-api/documentation/API-Reference-REST/BingVoiceOutput#SupLocales\nwhere name is the right most part of the voice font name (without optional Apollo suffix). Example:\n\n`Microsoft Server Speech Text to Speech Voice (ar-EG, Hoda)` name should be specified as `Hoda`\n\n`Microsoft Server Speech Text to Speech Voice (de-DE, Stefan, Apollo)` name should be specified as `Stefan`\n\n`Microsoft Server Speech Text to Speech Voice (en-US, BenjaminRUS)` name should be specified as `BenjaminRUS`\n\nAction is:\n\n\t/[Room name]/say/[phrase][/[name]][/[announce volume]]\n\t/sayall/[phrase][/[name]][/[announce volume]]\n\nExample:\n\n\t/Office/say/Hello, dinner is ready\n\t/Office/say/Hello, dinner is ready/BenjaminRUS\n\t/Office/say/Guten morgen/Stefan\n\t/sayall/Hello, dinner is ready\n\t/Office/say/Hello, dinner is ready/90\n\t/Office/say/Guten morgen/Stefan/90\n\nSupported voices are:\n\n Hoda, Naayf, Ivan, HerenaRUS, Jakub, Vit, HelleRUS, Michael, Karsten, Hedda, Stefan, Catherine, Linda, Susan, George, Ravi, ZiraRUS, BenjaminRUS, Laura, Pablo, Raul, Caroline, Julie, Paul, Cosimo, Ayumi, Ichiro, Daniel, Irina, Pavel, HuihuiRUS, Yaoyao, Kangkang, Tracy, Danny, Yating, Zhiwei\n\nSee https://www.microsoft.com/cognitive-services/en-us/speech-api/documentation/API-Reference-REST/BingVoiceOutput#SupLocales to identify\nwhich language and gender it maps against. If your desired voice is not in the list of supported one, raise an issue about adding it or send me a PR.\n\n#### AWS Polly\n\nRequires AWS access tokens, which you generate for your user. Since this uses the AWS SDK, it will look for settings in either Environment variables, the ~/.aws/credentials or ~/.aws/config.\n\nYou can also specify it for this application only, using:\n```json\n\t{\n\t  \"aws\": {\n\t    \"credentials\": {\n\t      \"region\": \"eu-west-1\",\n\t      \"accessKeyId\": \"Your access key id\",\n\t      \"secretAccessKey\": \"Your secret\"\n\t    },\n\t    \"name\": \"Joanna\"\n\t  }\n\t}\n```\n\nTo select the neural engine, append `Neural` to the name, e.g. `DanielNeural`.\n\nChoose the region where you registered your account, or the one closest to you.\n\nIf you have your credentials elsewhere and want to stick with the default voice, you still need to make sure that the aws config option is set to trigger AWS TTS:\n\n```json\n\t{\n\t  \"aws\": {}\n\t}\n```\n\nAction is:\n\n\t/[Room name]/say/[phrase][/[name]][/[announce volume]]\n\t/sayall/[phrase][/[name]][/[announce volume]]\n\nExample:\n\n\t/Office/say/Hello, dinner is ready\n\t/Office/say/Hello, dinner is ready/Nicole\n\t/Office/say/Hej, maten är klar/Astrid\n\t/sayall/Hello, dinner is ready\n\t/Office/say/Hello, dinner is ready/90\n\t/Office/say/Hej, maten är klar/Astrid/90\n\nThis is the current list of voice names and their corresponding language and accent (as of Dec 2016).\nTo get a current list of voices, you would need to use the AWS CLI and invoke the describe-voices command.\n\n| Language | Code | Gender | Name |\n| --------- | ---- | ------ | ---- |\n| Australian English | en-AU | Female | Nicole |\n| Australian English | en-AU | Male | Russell |\n| Brazilian Portuguese | pt-BR | Female | Vitoria |\n| Brazilian Portuguese | pt-BR | Male | Ricardo |\n| British English | en-GB | Male | Brian |\n| British English | en-GB | Female | Emma |\n| British English | en-GB | Female | Amy |\n| Canadian French | fr-CA | Female | Chantal |\n| Castilian Spanish | es-ES | Female | Conchita |\n| Castilian Spanish | es-ES | Male | Enrique |\n| Danish | da-DK | Female | Naja |\n| Danish | da-DK | Male | Mads |\n| Dutch | nl-NL | Male | Ruben |\n| Dutch | nl-NL | Female | Lotte |\n| French | fr-FR | Male | Mathieu |\n| French | fr-FR | Female | Celine |\n| German | de-DE | Female | Marlene |\n| German | de-DE | Male | Hans |\n| Icelandic | is-IS | Male | Karl |\n| Icelandic | is-IS | Female | Dora |\n| Indian English | en-IN | Female | Raveena |\n| Italian | it-IT | Female | Carla |\n| Italian | it-IT | Male | Giorgio |\n| Japanese | ja-JP | Female | Mizuki |\n| Norwegian | nb-NO | Female | Liv |\n| Polish | pl-PL | Female | Maja |\n| Polish | pl-PL | Male | Jacek |\n| Polish | pl-PL | Male | Jan |\n| Polish | pl-PL | Female | Ewa |\n| Portuguese | pt-PT | Female | Ines |\n| Portuguese | pt-PT | Male | Cristiano |\n| Romanian | ro-RO | Female | Carmen |\n| Russian | ru-RU | Female | Tatyana |\n| Russian | ru-RU | Male | Maxim |\n| Swedish | sv-SE | Female | Astrid |\n| Turkish | tr-TR | Female | Filiz |\n| US English | en-US | Male | Justin |\n| US English | en-US | Female | Joanna |\n| US English | en-US | Male | Joey |\n| US English | en-US | Female | Ivy |\n| US English | en-US | Female | Salli |\n| US English | en-US | Female | Kendra |\n| US English | en-US | Female | Kimberly |\n| US Spanish | es-US | Female | Penelope |\n| US Spanish | es-US | Male | Miguel |\n| Welsh | cy-GB | Female | Gwyneth |\n| Welsh English | en-GB-WLS | Male | Geraint |\n\n#### Elevenlabs\n\nElevenlabs is a TTS service enabling generatiung TTS audio files using AI generated voices.\n\nRequires API Key and optionally default voiceId.\n\nSince Elevenlabs AI models are multilingual by default, there is no need (nor place) for `language` parameter in \nElevenlabs API. Because of this, `language` parameter in URL is used to inject custom `voiceId` on per-request basis. You will\nneed to either configure default voiceId in `settings.json` or provide `voiceId` with every HTTP request.\n\n##### Config\n\nMinimal:\n```json\n\t{\n\t  \"elevenlabs\": {\n\t\t\"auth\": {\n\t\t  \"apiKey\": \"\"\n\t\t}\n\t  }\n\t}\n```\n\nFull:\n```json\n\t{\n\t  \"elevenlabs\": {\n\t\t\"auth\": {\n\t\t  \"apiKey\": \"\"\n\t\t},\n\t\t\"config\": {\n\t\t  \"voiceId\": \"\",\n\t\t  \"stability\": 0.5,\n\t\t  \"similarityBoost\": 0.5,\n\t\t  \"speakerBoost\": true,\n\t\t  \"style\": 1,\n\t\t  \"modelId\": \"eleven_multilingual_v2\"\n\t\t}\n\t  }\n\t}\n```\n\n#### Google (default if no other has been configured)\n\nDoes not require any API keys. Please note that Google has been known in the past to change the requirements for its Text-to-Speech API, and this may stop working in the future. There is also limiations to how many requests one is allowed to do in a specific time period.\n\nThe following language codes are supported\n\n| Language code | Language |\n| ------------- | -------- |\n| af | Afrikaans |\n| sq | Albanian |\n| ar | Arabic |\n| hy | Armenian |\n| bn | Bengali |\n| ca | Catalan |\n| zh | Chinese |\n| zh-cn | Chinese (Mandarin/China) |\n| zh-tw | Chinese (Mandarin/Taiwan) |\n| zh-yue | Chinese (Cantonese) |\n| hr | Croatian |\n| cs | Czech |\n| da | Danish |\n| nl | Dutch |\n| en | English |\n| en-au | English (Australia) |\n| en-gb | English (Great Britain) |\n| en-us | English (United States) |\n| eo | Esperanto |\n| fi | Finnish |\n| fr | Franch |\n| de | German |\n| el | Greek |\n| hi | Hindi |\n| hu | Hungarian |\n| is | Icelandic |\n| id | Indonesian |\n| it | Italian |\n| ja | Japanese |\n| ko | Korean |\n| la | Latin |\n| lv | Latvian |\n| mk | Macedonian |\n| no | Norwegian |\n| pl | Polish |\n| pt | Portuguese |\n| pt-br | Portuguese (Brazil) |\n| ro | Romanian |\n| ru | Russian |\n| sr | Serbian |\n| sk | Slovak |\n| es | Spanish |\n| es-es | Spanish (Spain) |\n| es-us | Spanish (United States) |\n| sw | Swahili |\n| sv | Swedish |\n| ta | Tamil |\n| th | Thai |\n| tr | Turkish |\n| vi | Vietnamese |\n| cy | Welsh |\n\nAction is:\n\n\t/[Room name]/say/[phrase][/[language_code]][/[announce volume]]\n\t/sayall/[phrase][/[language_code]][/[announce volume]]\n\n#### macOS say command\nOn macOS the \"say\" command can be used for text to speech. If your installation runs on macOS you can activate the system TTS by giving an empty configuration:\n\n```json\n{\n  \"macSay\": {}\n}\n```\n\nOr you can provide a default voice and a speech rate:\n\n```json\n{\n  \"macSay\": {\n  \t\"voice\" : \"Alex\",\n  \t\"rate\": 90\n  }\n}\n```\n\nAction is:\n\n\t/[Room name]/say/[phrase][/[voice]][/[announce volume]]\n\t/sayall/[phrase][/[voice]][/[announce volume]]\n\nExample:\n\n\t/Office/say/Hello, dinner is ready\n\t/Office/say/Hello, dinner is ready/Agnes\n\t/Office/say/Guten morgen/Anna\n\t/sayall/Hello, dinner is ready\n\t/Office/say/Hello, dinner is ready/90\n\t/Office/say/Guten morgen/Anna/90\n\nSupported voices are:\n\nAlex, Alice, Alva, Amelie, Anna, Carmit, Damayanti, Daniel, Diego, Ellen, Fiona, Fred, Ioana, Joana, Jorge, Juan, Kanya, Karen, Kyoko, Laura, Lekha, Luca, Luciana, Maged, Mariska, Mei-Jia, Melina, Milena, Moira, Monica, Nora, Paulina, Samantha, Sara, Satu, Sin-ji, Tessa, Thomas, Ting-Ting, Veena, Victoria, Xander, Yelda, Yuna, Yuri, Zosia, Zuzana\n\nA list of available voices can be printed by this command:\n```\n   say -v '?'\n```\n\nSee also https://gist.github.com/mculp/4b95752e25c456d425c6 and https://stackoverflow.com/questions/1489800/getting-list-of-mac-text-to-speech-voices-programmatically\n\nTo download more voices go to: System Preferences -\u003e Accessibility -\u003e Speech -\u003e System Voice\n\nLine-in\n-------\n\nConvenience method for selecting line in. Will select linein for zone-group, not detach it for line-in.\nOptional parameter is line-in from another player. Examples:\n\n`/Office/linein`\nSelects line-in on zone Office belongs to, with source Office.\n\n`/Office/linein/TV%20Room`\nSelects line-in for zone Office belongs to, with source TV Room.\n\nIf you want to to isolate a player and then select line-in, use the `/Office/leave` first.\n\nClip\n----\n\nLike \"Say\" but instead of a phrase, reference a custom track from the `static/clips` folder. There is a sample file available (courtesy of https://www.sound-ideas.com/).\n\n    /{Room name}/clip/{filename}[/{announce volume}]\n    /clipall/{filename}[/{announce volume}]\n\nExamples:\n\n    /clipall/sample_clip.mp3\n    /clipall/sample_clip.mp3/80\n    /Office/clip/sample_clip.mp3\n    /Office/clip/sample_clip.mp3/30\n\n*Pro-tip: announce your arrival with an epic theme song!*\n\nGrouping\n--------\n\nYou have basic grouping capabilities. `join` will join the selected player to the specified group (specify group by addressing any of the players in that group):\n\n`/Kitchen/join/Office`\nThis will join the Kitchen player to the group that Office currently belong to.\n\n`/Kitchen/leave`\nKitchen will leave any group it was part of and become a standalone player.\n\nYou don't have to ungroup a player in order to join it to another group, just join it to the new group and it will jump accordingly.\n\nSUB\n---\n\nSUB actions include the following:\n`/TV%20Room/sub/off`\nTurn off sub\n\n`/TV%20Room/sub/on`\nTurn on sub\n\n`/TV%20Room/sub/gain/3`\nAdjust gain, -15 to 15. You can make bigger adjustments, but I'm limiting it for now because it might damage the SUB.\n\n`/TV%20Room/sub/crossover/90`\nadjust crossover frequency in hz. Official values are 50 through 110 in increments of 10. Use other values at your own risk! My SUB gave a loud bang and shut down when setting this to high, and I thought I broke it. However, a restart woke it up again.\n\n`/TV%20Room/sub/polarity/1`\nSwitch \"placement adjustment\" or more commonly known as phase. 0 = 0°, 1 = 180°\n\nSpotify, Apple Music and Amazon Music (Experimental)\n----------------------\n\nAllows you to perform your own external searches for Spotify, Apple Music or Amazon Music songs or albums and play a specified song or track ID. The Music Search funtionality outlined further below performs a search of its own and plays the specified music.\n\nEnsure you have added and registered the respective service with your Sonos account, before trying to control your speakers with node-sonos-http-api. Instructions on how to do this can be found here: https://support.sonos.com/s/article/2757?language=en_US\n\nThe following endpoints are available:\n\n```\n# Spotify\n/RoomName/spotify/now/spotify:track:4LI1ykYGFCcXPWkrpcU7hn\n/RoomName/spotify/next/spotify:track:4LI1ykYGFCcXPWkrpcU7hn\n/RoomName/spotify/queue/spotify:track:4LI1ykYGFCcXPWkrpcU7hn\n\n# Apple Music\n/RoomName/applemusic/{now,next,queue}/song:{songID}\n/RoomName/applemusic/{now,next,queue}/album:{albumID}\n/RoomName/applemusic/{now,next,queue}/playlist:{playlistID}\n\n# Amazon Music\n/RoomName/amazonmusic/{now,next,queue}/song:{songID}\n/RoomName/amazonmusic/{now,next,queue}/album:{albumID}\n```\n\n**Spotify**\n\nYou can find the **Spotify** track and album IDs as the last part of the URL. \n\nHow to find the URL?\n- Web player: the address bar URL for albums and playlist; select _Copy Song Link_ from the dot menu. \n- Desktop client: via _Share \u003e Copy {Album,Playlist,Song} Link_\n- Mobile client: via _Share \u003e Copy Link_\n\nFor Spotify playlists, you'll need this format: `spotify:user:spotify:playlist:{playlistid}`. Even if it's a public playlist, you always need to prefix with `spotify:user:`. An example of a great playlist: `/kitchen/spotify/now/spotify:user:spotify:playlist:32O0SSXDNWDrMievPkV0Im`.\n\nTo get more technical, you actually use the Spotify URI (not URL) for the endpoint, like so: `{room}/spotify/{now,next,queue}/{spotifyuri}`.\n\nIt only handles a single **spotify** account currently. It will probably use the first account added on your system.\n\n**Apple Music**\n\nYou can find **Apple Music** song and album IDs via the [iTunes Search\nAPI](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/).\n\nYou can also use iTunes to figure out song, album, and playlist IDs. Right click on a song, album, or playlist and select \"Share\" -\u003e \"Copy Link\". You can do this when you searched within Apple Music or from your media library as long as the song is available in Apple Music.\n\nHave a look at the link you just copied. \n\n*If you shared the link to a song:*\nThe format is: https://itunes.apple.com/{countryCode}/album/{songName}/{albumID}?i={songID}\n\u003e eg: https://itunes.apple.com/de/album/blood-of-my-enemies/355363490?i=355364259\n\n*If you shared the link to an album:*\nThe format is: https://itunes.apple.com/{countryCode}/album/{albumName}/{albumID}\n\u003e eg: https://itunes.apple.com/de/album/f-g-restless/355363490\n\n*If you shared the link to a playlist:*\nThe format is: https://itunes.apple.com/{countryCode}/playlist/{playlistName}/{playlistID}\n\u003e eg: https://music.apple.com/gb/playlist/lofi-girls-favorites/pl.ed52c9eeaa0740079c21fa8e455b225e\n\n\n**Amazon Music**\n\nTo find **Amazon Music** song and album IDs you can use the Amazon Music App, search for a song or an album and share a link.\n\nLook at the link you just shared. This works with Amazon Music Prime as well as with Amazon Music Prime which is included in your Amazon Prime membership. \n\n*If you shared the link to a song:*\nThe format is: https://music.amazon.de/albums/{albumID}?trackAsin={songID}\u0026ref=dm_sh_d74d-4daa-dmcp-63cb-e8747\u0026musicTerritory=DE\u0026marketplaceId=A1PA6795UKMFR9\n\u003e eg: https://music.amazon.de/albums/B0727SH7LW?trackAsin=B071918VCR\u0026ref=dm_sh_d74d-4daa-dmcp-63cb-e8747\u0026musicTerritory=DE\u0026marketplaceId=A1PA6795UKMFR9\n\n*If you shared the link to an album:*\nThe format is: https://music.amazon.de/albums/{albumID}?ref=dm_sh_97aa-255b-dmcp-c6ba-4ff00\u0026musicTerritory=DE\u0026marketplaceId=A1PA6795UKMFR9\n\u003e eg: https://music.amazon.de/albums/B0727SH7LW?ref=dm_sh_97aa-255b-dmcp-c6ba-4ff00\u0026musicTerritory=DE\u0026marketplaceId=A1PA6795UKMFR9\n\nBBC Sounds (as of 2022 only available in the UK)\n----------------------\nEnsure you have added and registered the BBC Sounds service with your Sonos account, before trying to control your speakers with node-sonos-http-api. Instructions on how to do this can be found here: https://www.bbc.co.uk/sounds/help/questions/listening-on-a-smart-speaker/sonos or here: https://support.sonos.com/s/article/2757?language=en_US\n\nYou can specify a BBC station and the station will be played or set depending on the command used.\n\nTo play immediately:\n```\n/RoomName/bbcsounds/play/{stream code}\n```\nTo set the station without playing:\n```\n/RoomName/bbcsounds/set/{stream code}\n```\n\nRefer to the table below for available codes for BBC Radio Stations\n\n|  BBC Radio Station Name          | Stream Code                      |\n|----------------------------------|----------------------------------|\n|  BBC Radio 1                     | bbc_radio_one                    |\n|  BBC 1Xtra                       | bbc_1xtra                        |\n|  BBC 1Dance                      | bbc_radio_one_dance              |\n|  BBC 1Relax                      | bbc_radio_one_relax              |\n|  BBC Radio 2                     | bbc_radio_two                    |\n|  BBC Radio 3                     | bbc_radio_three                  |\n|  BBC Radio 4 FM                  | bbc_radio_fourfm                 |\n|  BBC Radio 4 LW                  | bbc_radio_fourlw                 |\n|  BBC Radio 4 Extra               | bbc_radio_four_extra             |\n|  BBC Radio 5 Live                | bbc_radio_five_live              |\n|  BBC Radio 5 Live Sports Extra   | bbc_five_live_sports_extra       |\n|  BBC Radio 6 Music               | bbc_6music                       |\n|  BBC Asian Network               | bbc_asian_network                |\n|  BBC Radio Berkshire             | bbc_radio_berkshire              |\n|  BBC Radio Bristol               | bbc_radio_bristol                |\n|  BBC Radio Cambridge             | bbc_radio_cambridge              |\n|  BBC Radio Cornwall              | bbc_radio_cornwall               |\n|  BBC Radio Cumbria               | bbc_radio_cumbria                |\n|  BBC Radio Cymru                 | bbc_radio_cymru                  |\n|  BBC Radio Cymru 2               | bbc_radio_cymru_2                |\n|  BBC Radio CWR                   | bbc_radio_coventry_warwickshire  |\n|  BBC Radio Derby                 | bbc_radio_derby                  |\n|  BBC Radio Devon                 | bbc_radio_devon                  |\n|  BBC Radio Essex                 | bbc_radio_essex                  |\n|  BBC Radio Foyle                 | bbc_radio_foyle                  |\n|  BBC Radio Gloucestershire       | bbc_radio_gloucestershire        |\n|  BBC Radio Guernsey              | bbc_radio_guernsey               |\n|  BBC Radio Hereford Worcester    | bbc_radio_hereford_worcester     |\n|  BBC Radio Humberside            | bbc_radio_humberside             |\n|  BBC Radio Jersey                | bbc_radio_jersey                 |\n|  BBC Radio Kent                  | bbc_radio_kent                   |\n|  BBC Radio Lancashire            | bbc_radio_lancashire             |\n|  BBC Radio Leeds                 | bbc_radio_leeds                  |\n|  BBC Radio Leicester             | bbc_radio_leicester              |\n|  BBC Radio Lincolnshire          | bbc_radio_lincolnshire           |\n|  BBC Radio London                | bbc_london                       |\n|  BBC Radio Manchester            | bbc_radio_manchester             |\n|  BBC Radio Merseyside            | bbc_radio_merseyside             |\n|  BBC Radio nan Gaidheal          | bbc_radio_nan_gaidheal           |\n|  BBC Radio Newcastle             | bbc_radio_newcastle              |\n|  BBC Radio Norfolk               | bc_radio_norfolk                 |\n|  BBC Radio Northampton           | bbc_radio_northampton            |\n|  BBC Radio Nottingham            | bbc_radio_nottingham             |\n|  BBC Radio Oxford                | bbc_radio_oxford                 |\n|  BBC Radio Scotland FM           | bbc_radio_scotland_fm            |\n|  BBC Radio Scotland Extra        | bbc_radio_scotland_mw            | \n|  BBC Radio Sheffield             | bbc_radio_sheffield              |\n|  BBC Radio Shropshire            | bbc_radio_shropshire             |\n|  BBC Radio Solent                | bbc_radio_solent                 |\n|  BBC Radio Somerset              | bbc_radio_somerset_sound         |\n|  BBC Radio Stoke                 | bbc_radio_stoke                  |\n|  BBC Radio Suffolk               | bbc_radio_suffolk                |\n|  BBC Radio Surrey                | bbc_radio_surrey                 |\n|  BBC Radio Sussex                | bbc_radio_sussex                 |\n|  BBC Radio Tees                  | bbc_tees                         |\n|  BBC Radio Three Counties Radio  | bbc_three_counties_radio         |\n|  BBC Radio Ulster                | bbc_radio_ulster                 |\n|  BBC Radio Wales                 | bbc_radio_wales_fm               |\n|  BBC Radio Wales Extra           | bbc_radio_wales_am               |\n|  BBC Radio Wiltshire             | bbc_radio_wiltshire              |\n|  BBC Radio WM                    | bbc_wm                           |\n|  BBC Radio York                  | bbc_radio_york                   |\n|  BBC World_Service               | bbc_world_service                |\n|  Cbeebies Radio                  | cbeebies_radio                   |\n\nSiriusXM\n----------------------\nYou can specify a SiriusXM channel number or station name and the station will be played.\n\n```\n/RoomName/siriusXM/{channel number,station name}\n```\n\n\nPandora\n----------------------\nPerform a search for one of your Pandora stations and begin playing. Give the currently playing song a thumbs up or thumbs down. Requires a valid Pandora account and credentials.\n\nThe following endpoints are available:\n\n```\n/RoomName/pandora/play/{station name}     Plays the closest match to the specified station name in your list of Pandora stations\n/RoomName/pandora/thumbsup                Gives the current playing Pandora song a thumbs up\n/RoomName/pandora/thumbsdown              Gives the current playing Pandora song a thumbs down\n```\n\nYour Pandora credentials need to be added to the settings.json file\n   ```\n          ,\n          \"pandora\": {\n            \"username\": \"your-pandora-account-email-address\",\n            \"password\": \"your-pandora-password\"\n          }\n  ```\n\n\nTunein\n----------------------\nGiven a station id this will play or set the streaming broadcast via the tunein service. You can find tunein station ids via services like [radiotime](http://opml.radiotime.com/)\n\nThe following endpoint is available:\n\n```\n/RoomName/tunein/play/{station id}\nWill set and start playing given Station id\n\n/RoomName/tunein/set/{station id}\nWill set without start playing given Station id\n```\n\nFor example to play Radio 6 Music - [tunein.com/radio/s44491](https://tunein.com/radio/s44491)\n\n```\n/RoomName/tunein/play/44491\nnote the droping of the 's' in 's44491'\n```\n\nMusic Search and Play\n----------------------\nPerform a search for a song, artist, album or station and begin playing. Supports Apple Music, Spotify, Deezer, Deezer Elite, and your local Music Library.\n\nThe following endpoint is available:\n\n```\n/RoomName/musicsearch/{service}/{type}/{search term}\n\nService options: apple, spotify, deezer, elite, library\n\nType options for apple, spotify, deezer, and elite: album, song, station, playlist\nStation plays a Pandora like artist radio station for a specified artist name.\nApple Music also supports song titles and artist name + song title.\n\nType options for library: album, song, load\nLoad performs an initial load or relaod of the local Sonos music library.\nThe music library will also get loaded the first time that the library service is\nused if the load command has not been issued before.\n\nSearch terms for song for all services: artist name, song title, artist name + song title\nSearch terms for album for all services: artist name, album title, artist name + album title\n\nSearch terms for station for apple: artist name, song title, artist name + song title\nSearch terms for station for spotify and deezer: artist name\nSearch terms for station for library: not supported\n\nSpecifying just an artist name will load the queue with up to 50 of the artist's most popular songs\nSpecifying a song title or artist + song title will insert the closest match to the song into\nthe queue and start playing it. More than 50 tracks can be loaded from the local library by using\nlibrary.randomQueueLimit in the settings.json file to set the maximum to a higher value.\n\nExamples:\n/Den/musicsearch/spotify/song/red+hot+chili+peppers\n/Kitchen/musicsearch/apple/song/dark+necessities\n/Playroom/musicsearch/library/song/red+hot+chili+peppers+dark+necessities\n\n/Den/musicsearch/spotify/album/abbey+road\n/Playroom/musicsearch/library/album/red+hot+chili+peppers+the+getaway\n/Kitchen/musicsearch/spotify/album/dark+necessities\n\n/Kitchen/musicsearch/spotify/playlist/morning+acoustic\n/Kitchen/musicsearch/spotify/playlist/dinner+with+friends\n\n/Den/musicsearch/spotify/station/red+hot+chili+peppers\n/Kitchen/musicsearch/apple/station/dark+necessities  (Only Apple Music supports song titles)\n/Playroom/musicsearch/apple/station/red+hot+chili+peppers+dark+necessities  (Only Apple Music supports song titles)\n\n/Kitchen/musicsearch/library/load  (Loads or reloads the music library from Sonos)\n```\n\n\nExperiment with these and leave feedback!\n\nWebhook\n-------\n\nNOTE! This is experimental and might change in the future! Please leave your feedback as github issues if you feel like it doesn't suit your need, since I don't know what kind of restrictions you will be facing.\n\nSince 0.17.x there is now support for a web hook. If you add a setting in settings.json like this:\n\n```\n{\n  \"webhook\": \"http://localhost:5007/\"\n}\n```\n\nEvery state change and topology change will be posted (method POST) to that URL, as JSON. The following data structure will be sent:\n\n```\n{\n  \"type\": \"transport-state\",\n  \"data\": { (snapshot of player) }\n}\n```\n\nor\n\n```\n{\n  \"type\": \"topology-change\",\n  \"data\": { (snapshot of zones) }\n}\n```\n\n```\n{\n  \"type\": \"volume-change\",\n  \"data\": {\n    \"uuid\": \"RINCON_000000000000001400\",\n    \"previousVolume\": 14,\n    \"newVolume\": 16,\n    \"roomName\": \"Office\"\n  }\n}\n```\n\n```\n{\n  \"type\": \"mute-change\",\n  \"data\": {\n    \"uuid\": \"RINCON_000000000000001400\",\n    \"previousMute\": true,\n    \"previousMute\": false,\n    \"roomName\": \"Office\"\n  }\n}\n```\n\n\"data\" property will be equal to the same data as you would get from /RoomName/state or /zones. There is an example endpoint in the root if this project called test_endpoint.js which you may fire up to get an understanding of what is posted, just invoke it with \"node test_endpoint.js\" in a terminal, and then start the http-api in another terminal.\n\n\nServer Sent Events\n-----\n\nAs an alternative to the web hook you can also call the `/events` endpoint to receive every state change and topology change as [Server Sent Event](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events).\nCompared to the web hook there is no configuration required on the server, and you can listen for events from multiple clients.\n\nBecause it is a long-polling connection, you must take care of errors in your client code and re-connect if necessary.\n\nThe server sends events formatted as single-line JSON in the format of Server Sent Events: every event starts with the string `data: `, followed by the single-line JSON formatted event, and is terminated by two new line characters.\n\nThere are [several client libraries available](https://en.wikipedia.org/wiki/Server-sent_events#Libraries) to listen for Server Sent Events.\nUsing `curl` yields the following output for some volume changes:\n\n```shell\nhost:~ user$ curl localhost:5005/events\ndata: {\"type\":\"volume-change\",\"data\":{\"uuid\":\"RINCON_E2832F58D9074C45B\",\"previousVolume\":13,\"newVolume\":19,\"roomName\":\"Office\"}}\n\ndata: {\"type\":\"volume-change\",\"data\":{\"uuid\":\"RINCON_E2832F58D9074C45B\",\"previousVolume\":19,\"newVolume\":25,\"roomName\":\"Office\"}}\n\ndata: {\"type\":\"volume-change\",\"data\":{\"uuid\":\"RINCON_E2832F58D9074C45B\",\"previousVolume\":25,\"newVolume\":24,\"roomName\":\"Office\"}}\n\ndata: {\"type\":\"volume-change\",\"data\":{\"uuid\":\"RINCON_E2832F58D9074C45B\",\"previousVolume\":23,\"newVolume\":23,\"roomName\":\"Office\"}}\n\n```\n\nDOCKER\n-----\n\nDocker usage is maintained by [Chris Nesbitt-Smith](https://github.com/chrisns) at [chrisns/docker-node-sonos-http-api](https://github.com/chrisns/docker-node-sonos-http-api)\n\n## FIREWALL\n\nIf you are running this in an environment where you manually have to unblock traffic to and from the machine, the following traffic needs to be allowed:\n\n### Incoming\n```\nTCP, port 3500 (Sonos events)\nUDP, port 1905 (Sonos initial discovery)\nTCP, port 5005 (if using the default api port)\nTCP, port 5006 (if using https support, optional)\n```\n### Outgoing\n```\nTCP, port 1400 (Sonos control commands)\nUDP, port 1900 (Sonos initial discovery)\nTCP, whatever port used for webhooks (optional)\nTCP, port 80/443 (for looking up hig res cover arts on various music services)\n```\n\nThe UDP traffic is a mixture of multicast (outgoing), broadcast (outgoing) and unicast (incoming). The multicast address is 239.255.255.250, the broadcast is 255.255.255.255 and the unicast is from the Sonos players.\n\nIf port 3500 is occupied while trying to bind it, it will try using 3501, 3502, 3503 etc. You would need to adjust your firewall rules accordingly, if running multiple instances of this software, or any other software utilizing these ports. \n\n### Projects built with this API\n\n**Alexa For Sonos (Alexa Skills)**\n\nAmazon Alexa voice layer on top of the amazing NodeJS component\nhttps://github.com/hypermoose/AlexaForSonos\n\n**Echo Sonos (Alexa Skills)**\n\nAmazon Echo integration with Sonos\nhttps://github.com/rgraciano/echo-sonos\n\n**JukeBot (Ruby)**\n\nA Slack bot that can control a Sonos instance. Custom spotify integration to find music.\nhttps://github.com/estiens/jukebot\n\n**Sonos Controller (JS / Electron)**\n\nA Sonos controller, built with the Electron framework.\nhttps://github.com/anton-christensen/sonos-controller\n\n**Sonos Cron (PHP)**\n\nService for retrieving commands from an AWS SQS queue and passing them to an instance of the Sonos HTTP API \nhttps://github.com/cjrpaterson/sonos-cron\n\n**Sonos Push Server (JS)**\n\nA Node server to receive notifications from node-sonos-http-api and push them via socket.io to the clients. \nhttps://github.com/TimoKorinth/sonos-push-server\n\n**SonoBoss (Siri Shortcut)**\n\nA ChatGPT-assisted Siri Shortcut that acts as a virtual assistant to let you find music and control Sonos through voice and chat.\nhttps://github.com/Barloew/SonoBoss\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjishi%2Fnode-sonos-http-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjishi%2Fnode-sonos-http-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjishi%2Fnode-sonos-http-api/lists"}