Control you SONOS with an IKEA TRADFRI remote control

Time to cook: 30min

Difficulty: +++++



In a previous recipe we covered how we can use an IKEA TRADFRI Remote Control and SonoS Smart Speakers in our system-of-systems architecture. With this recipe we show how you can use the remote to control your Sonos speaker.

 

Ingredients


  • IKEA Tradfri Remote Control

  • Sonos One

Prerequisites


  • Connecting an IKEA TRADFRI Remote Control

  • Connecting Sonos Smart Speakers


Tools

 

The Building Plan


First execute the recipe ‘Connecting an IKEA TRADFRI Remote Control’ and ‘Connecting Sonos Smart Speakers’.

We will use the IKEA TRADFRI Remote to Play/Pause the Sonos Speaker using the Toggle event from the remote (inner button)

The arrow left and right will be used to select a predefined radio station and the brightness up and down to control the audio volume.


Modifying the Node-RED flow


We will use the Node-RED flow from the recipe ‘‘Connecting an IKEA TRADFRI Remote Control’ to control the Sonos Smart Speaker.

The TRADFRI Remote Control can handle up to 11 different events. The events are all defined in the switch node in our Node-RED flow. To implement the above scenario, we need to configure 5 of the 11 events and connect them with the appropriate Sonos channel on our Smart HUB (cfr recipe: ‘Connecting Sonos Smart Speakers’).

The Play/Pause function can be implemented by sending the string “PLAY” or “PAUSE” to the ‘control’ channel of the Sonos Device. Each time the inner button on the Remote is pressed (toggle) the Sonos Control state must change from “PLAY” to “PAUSE” and reverse. A function Node translates the toggle function in the corresponding payload.





The selection of the Radio station is accomplished by sending the name of the radio station on the Radio channel. You must first predefine the radio’s using the Sonos APP. The radio station rotates when pressing the left or right arrow on the Remote. A function node keeps track of the radio stations:





The Volume is set by sending a value between 0 and 100 (%) on the volume channel from the Sonos device. Again a function node translate the button press (Brightness up and down) into a volume. I decided to use to increment or decrement the volume with 3(%) for each button press.





The complete flow is shown below and you can download the flow using the link.





Sonos One TRADFRI Remote
.zip
Download ZIP • 2KB





2 views0 comments

Recent Posts

See All