duncan3dc / sonos

A PHP library for interacting with Sonos speakers
Apache License 2.0
107 stars 32 forks source link

Question: TTS to a group of players #62

Open Liver64 opened 7 years ago

Liver64 commented 7 years ago

Hi Duncan, you did an amazing job on getting this library coded, this is the most robust coding i've seen to control Sonos. I did some php development to integrate Sonos into Loxone Home Automation based on the old PHPSonos.inc.php which i adopted and updated frequently, actually i'm stucked and think of to change my baseline you your code. One of the favorit functions of my user is that they e.g. actually can play something in a group, then build a new group for TTS, adjust the new group volume by Sonos "groupvolume", play generated or stored TTS and regroup to the old status. The Standard TTS Volume per Speaker is stored in the config, but there are some cases where they want to influence the volume up or down. Now my question: Can i code something similiar by using your API? Thanks in advance Oliver

Linkt to: LoxBerry

duncan3dc commented 7 years ago

Hi Oliver, thanks for your message, I'm glad you like the library.

I presume you've seen the interrupt feature, and you're talking about something similar to that, but allowing groupings to change?

So something like if the Kitchen was playing Pop, and the Garage was playing Rock, then you could do:

$group = new TemporaryGroup;
$group->addSpeaker($sonos->getSpeakerByRoom("Kitchen"));
$group->addSpeaker($sonos->getSpeakerByRoom("Garage"));

$group->interrupt($track);

And after the interruption the Kitchen would go back to Pop and the Garage back to Rock?

Liver64 commented 7 years ago

Hi Craig, thx for your quick answer. I recognized the interrupt function, but i wasn't sure if the function meet my needs. I give you a more detailed example: Group is playing Radio: Kitchen (Coordinator) Living Room (member) Kids 1 (member) Now i want to announce to: Kitchen Living Room Kids 2 a TTS. From the old group Kids 1 is now the new Coordinator and is still playing radio. Now i want to adjust volume for each speaker up or down (i use groupvolume) and play TTS (i know to send the TTS only to Coordinator). After the text has been announced i want that Kitchen and Living Room join back to the old group where Kids 1 is the Coordinator. Can i realize it somehow with your coding? Thanks in advance Oliver

Liver64 commented 7 years ago

Does anyone else get this running or can answer the question?

duncan3dc commented 7 years ago

Hi Oliver, yes I think you're asking for the TemporaryGroup feature I described above, I'm working on getting 2.0 out the door at the moment, but once that's released I'll look at adding this feature

duncan3dc commented 5 years ago

I've taken a look at this but it's quite complicated to do in a reliable way that handles all the possible scenarios.

I'll give it another crack when I get some time. You can take a look at the work in progress here if you like