I would like to put in a request to add Grouping of Sonos speakers. Like the Groups and Scenes app, could we get a Group that could group whichever sonos speakers we want in a set Group. I would like this for announcing arrivals and departures of family but I only want it to be on certain sonos speakers. And I would want it to resume playing whatever it was playing. Will this be possible at some point?
You can actually ‘group’ your sonos now using the sonos app
Once you have setup your group you just assign tts etc from Hubitat but you only need to use the ‘master’ of the group in any app (not each member of the group)
Oh yes, I know that except things change and the speakers don't always stay grouped into the group that you want. So if you have a speaker grouped into a group and then someone decides to listen to something else in that room then it isn't grouped anymore.
I know it is not the "easiest" way of doing it, but I am using a Node.js server running the Sonos HTTP API from jishi (GitHub - jishi/node-sonos-http-api: An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.) and send HTTP commands via that API to group/ungroup Sonos players. Works great and reliably for me.
I do use this method also and it works but if I were to try and make rules using RM to announce family arrivals and departures from different locations, it would be easier to have them grouped in HE and select that group to speak random messages. I have a WC piston that does this but if I were to try to get rid of it, I think this would be the best way to have random messages speak on certain speakers.
Why do you need the grouping for announcements with RM? You can select several Sonos speakers as Speech Device. That would speak the message on all of the selected once and continue playing what was on them after the announcement is done.
Yes, I have tried this but it isn't simultaneous. Sounds a bit funny.
Any update on this? We would prefer to Group and Ungroup various speakers through RM if possible.
The Sonos device driver needs to be updated to support Join capabilities and then RM could be updated to expose the drivers capability through the RM UI. Of course if the ability was there you could also create a custom command in RM too.
@mike.maxwell could join be added to the Sonos driver based on work others have done using Node.js above?
Any update regarding the ability to Group and Leave Sonos speakers from Hubitat?
This ability would be greatly appreciated.
Any updates? Perhaps there is a way to use a groovy device driver to group speakers so that we could create RM rules for various presets? We prefer this over setting up another server running node.js. Hey Google, turn on the party speaker preset!
+1 for this!! It would be awesome!
Can you explain how you are doing this? This would be a great "app" if we could do something. Thoughts?
I use a node server with the node-sonos-http-api from jishi
It has quite a list of supported sonos actions:
- playpause (toggles playing state)
- volume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
- groupVolume (parameter is absolute or relative volume. Prefix +/- indicates relative volume)
- mute / unmute
- groupMute / groupUnmute
- togglemute (toggles mute state)
- trackseek (parameter is queue index)
- timeseek (parameter is in seconds, 60 for 1:00, 120 for 2:00 etc)
- state (will return a json-representation of the current state of player)
- favorites (with optional "detailed" parameter)
- lockvolumes / unlockvolumes (experimental, will enforce the volume that was selected when locking!)
- repeat (on/off)
- shuffle (on/off)
- crossfade (on/off)
- pauseall (with optional timeout in minutes)
- resumeall (will resume the ones that was pause on the pauseall call. Useful for doorbell, phone calls, etc. Optional timeout)
- sleep (values in seconds)
- linein (only analog linein, not PLAYBAR yet)
- clip (announce custom mp3 clip)
- join / leave (Grouping actions)
- sub (on/off/gain/crossover/polarity) See SUB section for more info
- nightmode (on/off, PLAYBAR only)
- speechenhancement (on/off, PLAYBAR only)
- bass/treble (use -10 thru 10 as value. 0 is neutral)
For grouping, you can use the join/leave commands:
You have basic grouping capabilities.
joinwill join the selected player to the specified group (specify group by addressing any of the players in that group):
/Kitchen/join/OfficeThis will join the Kitchen player to the group that Office currently belong to.
/Kitchen/leaveKitchen will leave any group it was part of and become a standalone player.
You don't have to ungroup a player in order to join it to another group, just join it to the new group and it will jump accordingly.
If you want and app, you could create an app that has a virtual child device that supports speech. The child device could send the "text" to be spoken to the parent app and the parent app groups the sonos speakers before it sends the TTS to the master in the group.
Technically, it should work, might have play around with some timing to make sure that commands don't overlap.
EDIT: There is also a "sayall" command that speaks TTS on all Sonos devices. Not sure how synchronized it is though
The node.js app does work well and I already use it. However, if we could get RM to support grouping speakers, then all of us could simply the setup by using the Sonos devices within Hubitat. We would like to see a Leave and Join command added to Sonos devices. kitchenSonos.join(livingRoomSonos).
Is this possible?
Right now it is not possible within RM and it is also not as trivial as it sounds.....
First, the sonos drivers would need to support the grouping.
Once that is done, technically you could group it then via custom commands in RM.
But I can already see the request:
I have 6 sonos devices, my door opens and I want all of them to speak a message and revert back to what they were playing before.
So you technically would need to
a. Retrieve the current status of all Sonos devices
b. stop what they are playing (if you just start grouping that would play what the master is playing)
c. group them
e. ungroup them
f. Make them play what they were playing before (if that is even possible depending on what they were playing)
I use two different sets of Sonos speakers. One set for music, the second for dedicated notifications. I can mute the music, then play the notification, then unmute the music. A little more expensive to have a 2nd set of speakers, but much easier than trying to restore groups and previous tracks.
Again, can it be done via Hubitat Sonos device?
You can, together with the node server
You can do something like this:
Ignore the trigger event, I just selected something to have something. I also added some delays to let the joining happen.
Again, you can't do the grouping via RM directly, it is currently not supported