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.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.84k stars 461 forks source link

Ability to play TTS and then a favorite in preset #160

Open psmith3 opened 8 years ago

psmith3 commented 8 years ago

Is it possible to have a preset play a TTS phrase and then start a favorite playlist? I am looking for a way to announce what the favorite name is and then start playing the audio. I have an Insteon Keypadlinc setup to start the playlist and I currently have several commands send to the api, but I have to figure out the right amount of wait times in between the commands. If the wait is not long enough, the TTS stops too early or the next command to start the favorite never executes. Here is an example of the wait times in my ISY994i controller. It would be nice not to have to mess with the waits in the ISY and instead have the preset take care of these commands.

Kitchen - Play Ed Sheeran Radio - [ID 011B][Parent 011A]

If
      Control 'Kitchen Pantry Keypad / Preset - Next' is switched On

Then
        Resource 'Sonos - Kitchen - Speak Playng Ed Sheehan Radio'
        Wait  7 seconds
        Resource 'Sonos - Kitchen - Clear Queue'
        Wait  1 second
        Resource 'Sonos - Kitchen - Crossfade On'
        Wait  1 second
        Resource 'Sonos - Kitchen - Play Ed Sheeran Radio on Pandora'

Else
   - No Actions - (To add one, press 'Action')
jishi commented 8 years ago

Yeah, without have the option to wait for a certain action to finish, you will never be able to get this working reliably. Having a pre-announce TTS function seems like a good thing, I'll look into it after my refactoring of the sonos library.

jishi commented 7 years ago

This should now be possible to do with 2 different actions, since a say command now waits until the announce has finished and restored the group. However, announcing just to the preset group is a bit tricky. I guess that was the initial thought?

psmith3 commented 6 years ago

Yes, that was the initial thought. I want it to say something before the preset plays the favorite. So did I understand from the case #302 that this will work by putting the say command in the preset? Here is what I am trying, but it doesn't seem to work. Do I have the say command in the right spot?

{
    "players": [{
            "roomName": "Kitchen",
            "volume": 25
        },
        {
            "roomName": "Den",
            "volume": 20
        }
    ],
    "say": "Taylor Swift Radio",
    "playMode": {
        "shuffle": true,
        "crossfade": true
    },
    "pauseOthers": true,
    "favorite": "Taylor Swift Radio"
}
psmith3 commented 6 years ago

Maybe I am misunderstanding. @jishi Can you explain what you mean by "This should now be possible to do with 2 different actions"? Are you referring to 2 different actions in my ISY994i or in the preset script?