Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.
Published versions (recommended)
$ npm install sonos
From the repo, living on the edge
$ npm install git://github.com/bencevans/node-sonos.git
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);
})
})
})
const DeviceDiscovery = require('sonos').AsyncDeviceDiscovery
let discovery = new DeviceDiscovery()
discovery.discover().then((device, model) => {
// Do stuff, see examples/devicediscovery.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}`))
We tried to add jsdoc info to all functions, and generate documentation from it. /docs
Additional examples can be found in the /examples directory within the repository.
node-sonos in use across the interwebs. Missing yours? Add it and send us a pull request!
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.
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.
The best place to ask your questions is in Discord, we are there to help you. Join us on Discord.
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.
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.
name
of the project to @npm_username/sonos
npm publish --access=public
If you want to make this library better, you can follow these steps.
SONOS_HOST=192.168.x.x npm run test
to test your code (against an actual sonos device, change the ip)fix:
for a bugfix or feat:
for a new
feature followed by a short description. You can also follow with an
empty line followed by a more details description.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.
git remote add upstream https://github.com/bencevans/node-sonos.git
git fetch upstream
git checkout master
git rebase upstream/master
git push origin
MIT © Ben Evans
FAQs
Node.js Sonos Interface
We found that sonos demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.