[RELEASE] HubiThings Replica

Update 1/22/24: With the release of Sonos Advanced Controller, which provides a superior feature set, is native to Hubitat, and runs locally, this Replica driver will no longer be actively maintained,

=============================

RELEASE - Replica Sonos Driver

The driver can be imported from this link.

Why create a Replica Sonos driver when Hubitat has a native Sonos integration? The short answer is that the current Hubitat integration lacks certain useful features that are present in SmartThings' implementation. This replica driver provides a way to bridge those gaps until a better solution becomes available.

Advantages

  • This driver makes tracking the system topology easier by more clearly specifying each speaker's groupRole (primary, auxiliary, ungrouped) as well as IDs of the groupCoordinator and the overall group. This is helpful when creating complex automations on larger systems where groupings are frequently modified and/or there are multiple groups to manage. The IDs are particularly useful when using the Sonos Control API to modify group members and more.
  • Your Sonos Favorites (playlists, stations, etc.) can be played by ID, Name, or even randomly if neither ID or Name are specified.
  • The Favorites data is updated whenever there is change in them. By default, they are stored in a State Variable, sorted alphabetically by title. There is, however, a preference setting to create a JSON attribute that can be parsed and used in Rules or webCoRE if desired. This is disabled initially as the Favorites data is quite large and can stretch the length of your device page interminably.
  • The latest Sonos Edge Driver from SmartThings has a frequently requested preference setting (available only in the ST app at this time) to set a default queueAction (Append, Replace, Insert, or InsertNext) for each device. Most people will choose "Replace," thus ensuring that the queue is cleared before a new Favorite is loaded. Again, that selection has to be made in the ST app itself, but the setting is respected by the replica driver.
  • Additional group controls include Set Group Volume, Group Volume Up, Group Volume Down, Group Mute, and Group Unmute are available. Correspondingly, there are attributes that provide the current state of Group Volume and Group Mute.
  • In the same manner as the native HE integration, trackData is provided in an accessible JSON format and provides album, artist, tile, and album art information that can be used in a dashboard tile.

The following capabilities are not supported, as they are not currently available in the SmartThings Edge driver (beta).

  • playModes (Shuffle, Crossfade, Repeat, RepeatOne). These will be hopefully be coming in the future.
  • Join/Leave for creating and managing speaker groups. This is possible via the Control API or by running a local service like the very popular node-http-sonos-api.
  • Play Text (Capability exists in SmartThings, but is not currently exposed by the API).

Known Issues

  • This replica driver is intended for use with Sonos speakers running in SmartThings via the Sonos driver for Edge, which is still technically in beta. As the older groovy DTH driver is being deprecated in the very near future, it will not be supported, even to the extent it may work.

Using this driver will not impact your current Hubitat integration. You may test/run this driver concurrently. Just give your HubiThings Sonos devices unique names and avoid sending duplicate commands to your HE and replica devices.

3 Likes