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.
- Device Discovery
- Queue Control
- Volume Control
- Spotify Support
- Radio
- Change Events
Published versions (reccomended)
$ npm install sonos
From the repo, living on the edge
$ npm install git://github.com/bencevans/node-sonos.git
For detailed info read the /API.md file, else…
- search([options], [deviceAvailableListener])
- Class: Search([options])
- Event: 'DeviceAvailable'
- destroy()
- Class: Sonos(host, [port])
- currentTrack(callback)
- deviceDescription(callback)
- flush(callback)
- getCurrentState(callback)
- getLEDState(callback)
- getMusicLibrary(search, options, callback)
- getMuted(callback)
- getTopology(callback)
- getVolume(callback)
- getZoneAttrs(callback)
- getZoneInfo(callback)
- getQueue(callback)
- next(callback)
- parseDIDL(didl)
- pause(callback)
- play(uri, callback)
- previous(callback)
- queue(uri, positionInQueue, callback)
- queueNext(uri, callback)
- request(endpoint, action, body, responseTag, callback)
- seek(seconds, callback)
- setLEDState(desiredState, callback)
- setMuted(muted, callback)
- setName(name, callback)
- getPlayMode(callback)
- setPlayMode(mode, callback)
- setVolume(volume, callback)
- stop(callback)
- setSpotifyRegion(region)
- alarmClockService()
- ListAlarms(callback)
- PatchAlarm(id,options,callback)
- SetAlarm(id,enabled,callback)
- joinGroup(otherDeviceName, callback)
- leaveGroup(callback)
- startListening(options, callback)
- stopListening(callback)
- Event: 'TrackChanged'
- Event: 'VolumeChanged'
- Event: 'StateChanged'
- Event: 'Muted'
node-sonos in use across the interwebs. Missing yours? Add it and send us a pull request!
- 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
- How we gave our studio WWE-style entrances using iBeacons and Sonos - A technical run-down of using futuristic technology for sheer entertainment value
Additional examples can be found in the /examples directory within the repository.
- Ben Evans (@bencevans)
- Stephen Wan (@stephen)
- Marshall T. Rose (@mrose17)
- Stephan van Rooij (@svrooij)
And a big thanks to all you other contributors! Pull-requests are beautiful things.
MIT © Ben Evans