https://github.com/bencevans/node-sonos
π Sonos Media Player Interface/Client
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
βCITATION.cff file
-
βcodemeta.json file
Found codemeta.json file -
β.zenodo.json file
-
βDOI references
-
βAcademic publication links
-
βCommitters with academic emails
-
βInstitutional organization owner
-
βJOSS paper metadata
-
βScientific vocabulary similarity
Low similarity (11.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
π Sonos Media Player Interface/Client
Basic Info
- Host: GitHub
- Owner: bencevans
- License: mit
- Language: JavaScript
- Default Branch: master
- Homepage: https://www.npmjs.com/package/sonos
- Size: 2.37 MB
Statistics
- Stars: 710
- Watchers: 30
- Forks: 148
- Open Issues: 20
- Releases: 53
Topics
Metadata Files
README.md
node-sonos
Control your Sonos devices with JavaScript (node.js)
node-sonos gives you the power to control all your Sonos devices from your own apps in JavaScript. Automatically discover your devices on the network and control the playback and queue with instant events announcing change.
Features
- Device Discovery
- Queue Control
- Volume Control
- Spotify Support
- Radio
- Change Events
Install
Published versions (recommended)
$ npm install sonos
From the repo, living on the edge
$ npm install git://github.com/bencevans/node-sonos.git
Quick Start
Discovering Devices
```js const { DeviceDiscovery } = require('sonos')
// event on all found... DeviceDiscovery((device) => { console.log('found device at ' + device.host)
// mute every device...
device.setMuted(true)
.then(d => console.log(${d.host} now muted))
})
// find one device DeviceDiscovery().once('DeviceAvailable', (device) => { console.log('found device at ' + device.host)
// get all groups device.getAllGroups().then(groups => { groups.forEach(group => { console.log(group.Name); }) }) }) ```
Discovering devices async
js
const DeviceDiscovery = require('sonos').AsyncDeviceDiscovery
let discovery = new DeviceDiscovery()
discovery.discover().then((device, model) => {
// Do stuff, see examples/devicediscovery.js
})
Controlling Known Devices
```js const { Sonos } = require('sonos')
const device = new Sonos('192.168.1.56');
device.play() .then(() => console.log('now playing'))
device.getVolume()
.then((volume) => console.log(current volume = ${volume}))
```
API
- DeviceDiscovery([options], [deviceAvailableListener])
- Class: DeviceDiscovery([options])
- Event: 'DeviceAvailable'
- destroy()
- Class: 'AsyncDeviceDiscovery'
- discover([options])
- discoverMultiple([options])
- Class: Sonos(host, [port])
- currentTrack()
- deviceDescription()
- flush()
- getCurrentState()
- getLEDState()
- getMusicLibrary(search, options)
- getMuted()
- ~~getTopology()~~ Doesn't work if you upgraded to Sonos v9.1. Check-out getAllGroups() for some replacement.
- getVolume()
- getZoneAttrs()
- getZoneInfo()
- getQueue()
- next()
- parseDIDL(didl)
- pause()
- play(uri)
- togglePlayback()
- previous()
- queue(uri, positionInQueue)
- queueNext(uri)
- request(endpoint, action, body, responseTag)
- seek(seconds)
- setLEDState(desiredState)
- setMuted(muted)
- setName(name)
- getPlayMode()
- setPlayMode(mode)
- setVolume(volume)
- stop()
- setSpotifyRegion(region)
- alarmClockService()
- ListAlarms()
- PatchAlarm(id,options)
- SetAlarm(id,enabled)
- joinGroup(otherDeviceName)
- leaveGroup()
- getAllGroups()
- startListening(options)
- stopListening()
- Event: 'CurrentTrack'
- Event: 'NextTrack'
- Event: 'PlayState' and 'PlaybackStopped'
- Event: 'AVTransport'
- Event: 'Volume'
- Event: 'Muted'
- Event: 'RenderingControl'
Documentation
We tried to add jsdoc info to all functions, and generate documentation from it. /docs
Examples
Additional examples can be found in the /examples directory within the repository.
In The Wild
node-sonos in use across the interwebs. Missing yours? Add it and send us a pull request!
Apps
- AirSonos - Apple AirPlay (iOS, OS X) support to all Sonos devices on a network.
- sonos-cli - Command Line Interface for Sonos
- sonos2mqtt - Bridge between Sonos and an MQTT server
- homebridge-zp - Homebridge plugin for Sonos ZonePlayer
- ZenMusic - Control Sonos thru #Slack!
- gladys-sonos - Control Sonos with Gladys a Raspberry Pi Home Assistant
- sonos-web - Sonos controller for your web browser
- BudgieStream - Stream system output to Sonos
- GrooveSensor - Motion-activated Sonos playback
Writeups
- How we gave our studio WWE-style entrances using iBeacons and Sonos - A technical run-down of using futuristic technology for sheer entertainment value
Maintainers
- Ben Evans (@bencevans)
- Stephen Wan (@stephen)
- Marshall T. Rose (@mrose17)
- Stephan van Rooij (@svrooij)
Contributors β¨
<!-- ALL-CONTRIBUTORS-BADGE:END -->
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification.
Contributions of any kind welcome!
You can get added by mentioning
the @all-contributors bot in a pr or issue.
If we missed you, just go to your (closed) issue or pr and mention the bot to get added.
Issues
If you got discovered an issue with this library, please check the issue-tracker. And create an issue if your problem isn't discovered by someone else. If you want to contribute something check out these 'help-wanted' issues.
Questions
The best place to ask your questions is in Discord, we are there to help you. Join us on Discord.
Unsupported sonos features
There is a great other library to control Sonos with Python, they also have a great list of all possible soap actions here. So if you have anything that you cannot do with node-sonos but that you can with the official app. You could have a look in the above list, or use wireshark to investigate the protocol.
NPM publish
We try to react to all pull-requests, but if you think we don't respond in time, please don't create a 'sonos-by-xyz' or a 'node-sonos-by-xyz' package on NPM. This might lead to people installing the wrong version.
If you want to publish your own version, please do it as a user-scoped eg. @svrooij/sonos package.
- Change the top of the readme to state your specific changes.
- Change the
nameof the project to@npm_username/sonos - Publish it to npm
npm publish --access=public
Development
If you want to make this library better, you can follow these steps.
- Create a fork
- Make changes
- (optional) Create tests for the feature or the bug, see sonos.test.js.
- Run
SONOS_HOST=192.168.x.x npm run testto test your code (against an actual sonos device, change the ip) - Check-in your code in a single commit.
Make sure your commit starts with
fix:for a bugfix orfeat:for a new feature followed by a short description. You can also follow with an empty line followed by a more details description. - Send a pull-request
- Hold-on, we will be checking them.
If you already had a fork, make sure it is updated with the latest master so things don't get complicated when we want to merge the PR.
bash
git remote add upstream https://github.com/bencevans/node-sonos.git
git fetch upstream
git checkout master
git rebase upstream/master
git push origin
Licence
MIT Β© Ben Evans
Owner
- Name: Ben Evans
- Login: bencevans
- Kind: user
- Location: London, UK
- Company: Institute of Zoology, ZSL
- Website: https://bencevans.io/
- Twitter: bencevans
- Repositories: 282
- Profile: https://github.com/bencevans
GitHub Events
Total
- Watch event: 7
- Push event: 1
- Pull request review event: 1
- Pull request event: 4
- Fork event: 5
- Create event: 1
Last Year
- Watch event: 7
- Push event: 1
- Pull request review event: 1
- Pull request event: 4
- Fork event: 5
- Create event: 1
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Ben Evans | b****n@b****k | 137 |
| Stephan van Rooij | g****b@s****l | 127 |
| Renovate Bot | b****t@r****m | 84 |
| dependabot[bot] | 4****] | 32 |
| scotts@microsoft.com | s****s@m****m | 25 |
| Stephan van Rooij | 1****j | 18 |
| Marshall Rose | m****7@g****m | 15 |
| greenkeeperio-bot | s****t@g****o | 15 |
| Pascal Opitz | c****t@p****m | 14 |
| Stephen Wan | s****n@s****t | 14 |
| Stephan van Rooij | s****j@f****l | 13 |
| Nicholas Villarreal | n****l@g****m | 11 |
| renovate[bot] | r****] | 9 |
| Shobhit Gupta | s****t@g****m | 6 |
| Matthias BruΜnning | m****g@m****m | 5 |
| Anthony Brown | a****n@j****k | 5 |
| Martin Giger | m****n@h****e | 5 |
| ebaauw | e****w@x****l | 4 |
| Monsur Hossain | m****r@g****m | 4 |
| Thomas Mirlacher | t****s@m****t | 4 |
| Alan Layng | a****n@r****m | 3 |
| Niels Keurentjes | n****s@k****l | 3 |
| greenkeeper[bot] | g****] | 3 |
| Tobias Hultman | t****n@g****m | 3 |
| Manuel Heim | m****7@g****m | 3 |
| Ben | b****9@y****e | 3 |
| Wayne Lee | w****e@s****m | 3 |
| MikiDi | M****i | 2 |
| Marko Harjula | m****a@g****m | 2 |
| Jason Woods | d****l@j****k | 2 |
| and 38 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 49
- Total pull requests: 69
- Average time to close issues: 2 months
- Average time to close pull requests: 2 months
- Total issue authors: 36
- Total pull request authors: 15
- Average comments per issue: 3.78
- Average comments per pull request: 1.45
- Merged pull requests: 53
- Bot issues: 0
- Bot pull requests: 33
Past Year
- Issues: 0
- Pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: 21 days
- Issue authors: 0
- Pull request authors: 3
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
- svrooij (6)
- hklages (6)
- tboudri (2)
- GerritKuilder (2)
- realwakils (2)
- irdeto-hackwestern (1)
- raylway (1)
- htilly (1)
- gillescastel (1)
- AUTplayed (1)
- jordansissel (1)
- printerboi (1)
- Stanned (1)
- tylermenezes (1)
- pierrephi (1)
Pull Request Authors
- dependabot[bot] (34)
- pascalopitz (9)
- svrooij (8)
- stufisher (5)
- bencevans (2)
- recursivefunk (2)
- qianc (2)
- kcghost (2)
- mmathys (1)
- TKirmani (1)
- reyes256 (1)
- filahf (1)
- blanck (1)
- 2xAA (1)
- yoogie27 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- npm 1,492 last-month
- Total docker downloads: 30
-
Total dependent packages: 42
(may contain duplicates) -
Total dependent repositories: 99
(may contain duplicates) - Total versions: 96
- Total maintainers: 4
npmjs.org: sonos
Node.js Sonos Interface
- Homepage: https://github.com/bencevans/node-sonos#readme
- License: MIT
-
Latest release: 1.14.1
published almost 5 years ago
Rankings
npmjs.org: sonos-br-kyv
Node.js Sonos Interface
- Homepage: https://github.com/bencevans/node-sonos
- License: MIT
- Status: deprecated
-
Latest release: 0.8.8
published over 10 years ago
Rankings
Maintainers (1)
npmjs.org: @qiancs/sonos
Node.js Sonos Interface
- Homepage: https://github.com/bencevans/node-sonos#readme
- License: MIT
-
Latest release: 1.14.2
published about 1 year ago
Rankings
Maintainers (1)
Dependencies
- 324 dependencies
- @bencevans/jsdox 0.4.11 development
- mocha 6.2.0 development
- nock 10.0.6 development
- pre-commit 1.2.2 development
- standard 13.1.0 development
- axios ^0.21.1
- debug ^4.3.1
- ip ^1.1.5
- xml2js ^0.4.23
- actions/checkout v1 composite
- actions/setup-node v1 composite
- cycjimmy/semantic-release-action v2 composite
- svrooij/secret-gate-action v1 composite