Created At

Feb 08, 2022

Last Update

Dec 02, 2024

Platforms

HC 3 Lite, Z-box Hub, Yubii Home Pro, Venture WISE, HC 3

Views

6207

Download

573

Type Quick App

Notice (december 2024)

The Sonos Automation Controller Quick App is the upgraded and improved replacement for this Quick App. With support for the latest Sonos S2 JSON API, this new Quick App provides a better integration with your HC3.

This Quick App will soon be removed from the marketplace, so I recommend transitioning to the new version.

---------------------------------------------------------------------------------------------------------

There are some Sonos Quick Apps already available for the Home Center 3, but none of them can group and ungroup Sonos speakers.

This Quick App that has little to no impact on your network because it doesn't use polling for status. It is made for use in Lua scenes or other Quick Apps and has a minimal GUI that can be refreshed manually.

Release notes

v1.4.0

  • Added function to set a sleep timer on your Sonos player with a Lua scene.

v1.3.0

  • Fixed QuickApp crash when Explore Sonos Radio was set as a favorite.

v1.2.0

  • Fixed QuickApp crash when a favorite has no metadata.
  • Fixed an error in the documentation.

v1.1.0

  • Fixed QuickApp crash when less than 4 favorites.
  • Fixed saved playback state incorrect when player becomes offline.
  • Fixed an error in the documentation.

Possibilities

From a Lua scene (or Quick App) you can:

  • Start a Sonos Favorite at a specified volume.
  • Set the volume of a Sonos speaker.
  • Save the player state (like PLAY/STOP) and automatically pause.
  • Get the previous player state and resume this state.
  • Create or add a Sonos speaker to a group.
  • Remove a Sonos speaker from a group.
  • Set a sleep timer on the Sonos player.

My Sonos list notice

Sonos stores playlists, InTunes stations and albums in My Sonos in alphabetical order. You cannot adjust this. The first 4 items are shown, but you can play all favorites easily which I show you later on.

Usage in Lua scenes

With the following code examples I'll show you how you can use the Sonos Group Controller Quick App to fully automate your music expecience in your smarthome:

In all examples the variable qaId is the ID of your Quick App.

E.g. 1: Save Sonos player state when everybody left the house

fibaro.call(qaId, "savePlayStateAndPause")

Useful in presence detection automations where you want to save the state of your players and automatically pause all players when everybody left the house.This command saves the current player state (like PLAY/STOP) and pauses the player.

E.g. 2: Set the previous Sonos player state when the first person arrives at home

fibaro.call(qaId, "setPreviousPlayerState")

Useful in presence detection automations where you want to automatically set the previous state of your players when the first person arrives at home.This command retrieves the previous saved player state (like PLAY/STOP) and turns the speaker back on if it was playing music.

E.g. 3: Play a My Sonos favorite at a specific volume

fibaro.call(qaId, "playFavorite", "title", "15")

Easily play a favorite from the My Sonos list by using the title of the favorite. The second parameter is the volume at which you want to play this favorite. First the volume is set before the favorite is played, so that you are not surprised with a loud volume from a previous listening session.

E.g. 4: Add the Sonos player to a group (or create a new one)

local playerSource = "x-rincon:" .. fibaro.getValue(1001, "model")
fibaro.call(1002, "playFromUri", playerSource , "")

With this command you can add a player to a group (or create one). Use the playerUuid from the speaker that is currently playing the music (the group master).

In this example the livingroom speaker with an id of 1001 is playing and you want to create a group with the kitchen speaker (with an id of 1002). You first contruct the Uri with the id from the livingroom speaker and then add this Uri to the kitchen speaker. Now the Sonos System creates a group.

E.g. 5: Remove the Sonos player from a group

fibaro.call(qaId, "LeaveGroup")

When you send this command to a Sonos speaker it automatically leaves the group it is in.

E.g. 6: Set a sleep timer on a Sonos player

fibaro.call(qaId, "configureSleepTimer", "23:15:00")

When you send this command to a Sonos speaker it turns off the music at 23:15 (Sonos sleep timer function).

Full documentation

You can read the full documentation of the Sonos Group Controller Quick App at:
https://docs.joepverhaeg.nl/sonos-group-controller/

18 Comments,  Want to add comment please login
2b1e35a46ff53a0c1c564de71e3b31fb

Many thanks Joep! Working on it already :-)

7e55719745ae9e37e0996f355585fffc

@Martijn, it took a while, but this morning the QA is approved and available again. Have fun!

2b1e35a46ff53a0c1c564de71e3b31fb

@Joep Thanks for providing an update. Can't wait to test the new version when it comes online. Appreciated if you can spend a posting here if the file becomes available for us!

7e55719745ae9e37e0996f355585fffc

@Remko Meijer, I pushed an update two days ago and Fibaro has to approve it. Until that time it seems that the link is offline :(

44708e3966cf8e906893255223998db0

Hi Joep, sorry to bother you, but i cannot find the new QA: https://marketplace.fibaro.com/items/sonos-s2-automation-controller Do you have any idear where to get this? Thank you!

© 2024. Nice-Polska Sp. z o.o.Privacy policyTerms & ConditionsFeedback