Sonos

evasmolders edited this page Jan 15, 2017 · 4 revisions
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.

Sonos 1

Introduction

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.

Hardware

To integrate OpenRemote and Sonos, we have tested the Sonos products listed in the table below.

For a complete setup, you will need:

Sonos 2

Configuration of System

Pre-requisites:

  • Download and Install Node.js for your OS from Nodejs
  • Download "Sonos HTTP API" Node server from GitHub

Installation

Start by fixing your dependencies. Invoke the following command:

Sonos 3

This will download the necessary dependencies if possible (you will need git for this)

Start the server by running:

Sonos 4

Now you can control your system by invoking the following commands:

Sonos 5

Example:

Sonos 6

The actions supported as of today:

  • play
  • pause
  • volume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
  • seek (parameter is queue index)
  • next
  • previous
  • 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.

Sonos sonos-http

These commands can be connected to buttons in UI Designer View.

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:

Sonos 7

See also

External Links:

Designer Reference Documentation: