That looks like something I'll implement as an additional feature but I would still like to keep Alexa listening for about 30 seconds so I can give individual commands.therealbiglou wrote:Yes there is! I recently asked about this myself and kgschlosser came up with a great solution.SDeGonge wrote:Is there a way to make the skill stay connected (with a timeout) so multiple commands can be send without having to say "Alexa ask <skill name> to..." each time?
I'm using this to mimic my SageTV remote so navigation becomes a real pain (ie: up up right enter).
Great skill by the way!
Create a new Python Script action and paste the following:
Code: Select all
suffixes= eg.event.payload.split(' and ') for suffix in suffixes: # the 2 options below will give you a "pretty" event suffix this is if you # are not using the actual suffix for anything other then just triggering # an event # remove the # before the next line if you would like all the first letters # in the suffix to be capital but not to mess with anything that might be # like NBC it will stay the same #suffix = ' '.join(list(word.upper() + word[1:] for word in suffix.split(' '))) # remove the # from the next line if you would like to remove all of the # spaces from the suffix #suffix = suffix.replace(' ', '') # swap the # between these 2 depending if you want to have the "Main." # in your event eg.TriggerEvent(prefrix='EchoToEG', suffix=suffix) #eg.TriggerEvent(suffix='EchoToEG.' + suffix)
So your code will let me ask...Alexa ask <skill name> to up AND up AND up AND right AND enter, for example which is good but I would also like to have the option to say...
Alexa <skill name>, wait for her to say "ready", then say up, up, up, right, enter. When she's done the connection would stay open for xx more seconds in case I wanted to give her more commands.
So I answered my own question on this....
Yes, you can keep Alexa listening.
In Lambda function callEchoToEG you need to change var shouldEndSession from true to false, that's it!
Now after you initiate Alexa will keep listening.
After a short time of silence you will get a "I could not understand..." prompt. A short time after that it will timeout and disconnect.
You can also say "exit" to terminate the connection.
This works well except for one thing...since I'm using it to control the TV Alexa responds to the TV's dialog. I'll have to mute or pause when the connection is made an unmute or resume when I exit.