Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Clone this wiki locally
Sonos is a Multi-Room Music System. When integrating Sonos with OpenRemote, you gain a customizable user interface and also an ability to control Sonos from existing automation systems such as KNX, Z-Wave or EnOcean, including audio controls from physical switches, Android and iOS devices and from PC desktops. This how-to helps you to integrate Sonos with the rest of your house's lighting, curtain, shades and A/V controls.
The Sonos Wireless HiFi System allows for streaming of music from internet sources, in multiple rooms within range, via wi-fi (802.11). Expansion can be achieved through the addition of the wireless bridge, which allows for greater range.
There are two main types of players in the Sonos Music System: all in one speakers and components. Components connect directly to unpowered speakers CONNECT:AMP, or to an amplifier/receiver CONNECT, which allows existing speakers to become Sonos rooms. All-in-one speakers allow any room with a power outlet to play audio. There is also a wireless Subwoofer that connects to any all-in-one speaker or amplified component.
With OpenRemote you can now control the basic functions in your Sonos system, as well as get info about the players condition such as song playing etc.
To integrate OpenRemote and Sonos, we have tested the Sonos products listed in the table below.
For a complete setup, you will need:
- A Sonos system
- OpenRemote Controller installed on your PC, RPi, NAS, etc.
- OpenRemote Designer Account
- A web browser, Android or iOS device for control
- Additional automation controls for lighting, curtains, switches, etc.
Configuration of System
- Download and Install Node.js for your OS from Nodejs
- Download "Sonos HTTP API" Node server from GitHub
Start by fixing your dependencies. Invoke the following command:
This will download the necessary dependencies if possible (you will need git for this)
Start the server by running:
Now you can control your system by invoking the following commands:
The actions supported as of today:
- volume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
- seek (parameter is queue index)
- state (will return a json-representation of the current state of player)
OpenRemote Designer Configuration
Create HTTP commands in OpenRemote Designer for all necessary controls you need, e.g: play, pause, next, etc.
Displaying Sonos State Variables
For command 'state', also create a custom state sensor and use the JSONPath Expression property to display the desired values in a label widget.
The example JSON response value for a 'state' command is shown below:
Designer Reference Documentation: