I just found the timeout setting in the basic settings of the Lambda function. I bumped that up to 7 seconds. I’ll report back if that did the trick.
Three seconds was the default.
I just found the timeout setting in the basic settings of the Lambda function. I bumped that up to 7 seconds. I’ll report back if that did the trick.
Three seconds was the default.
That fixed most of my issues. But my “time for bed” skill is still running into problems. I set the lambda timeout to 7 seconds because Alexa has an 8 second timeout.
It looks like the Home Assistant skill waits until everything completes before returning a success code and the speech text. I can understand why this happens. I guess there’s really no way to tell Home Assistant to reply and not wait for successful completion of the skill’s actions. And there’ll be cases where you want to get some value from the skill’s actions to use in the reply, so HA can’t simply respond without waiting.
I guess it’d be great if there was an option for intents to say “respond right away”.
Are there any tricks to achieve this? Like put everything in a script instead of in the intent’s actions?
This skill/intent worked fine before I switched to using the lambda (so that I could ditch api_password).
how is your intent tailored? Is this an intent with a duration? If so, you can strip the whole intent out into a script. And make your intent fire the script. The intent should immediately finish while the script takes it’s time.
EDIT: Also, I would consider this a bug for intents if it produces an error
I just checked. I do have all of the intent’s actions in a script because I can also start the same action via a button-press. The script itself only turns off two booleans, but changing the booleans kicks off other actions that watch for their state change.
When I started “time for bed”, I watched the Alexa ring spin for ~7 seconds (the lambda timeout), then return “there was a problem…”
That’s odd, can you share the script/intent?
EDIT: I still think it’s a bug.
The intent just has one script as its action. The script just changes the values of 2 booleans.
It’s an intent_script (not in the alexa: block) because I can call it from a Google device, too.
It does not have a speech block. Doc’s say that block’s optional and I get a spoken confirmation from TTS.
Given, when the two booleans change (we’ve gone to bed), a lot of stuff happens - everything (lights, Harmony, etc) turns off, the alarm arms, etc.
Hmm, so it most likely takes longer than 8 seconds to execute. I would think that wrapping in a script separate from the intent would skip the duration it takes to execute. You could for testing purposes verify this by placing a voice response at the beginning and end of the intent.
The difficult thing about that is that there are other automations that react to the booleans changing. So I can put a TTS before and after setting them, but that doesn’t really book-end the actions that’ll take place.
I just added a speech response to the intent_script to see if that perhaps triggers HA to respond more quickly. It appears to work - I got the response instead of “there was an error…” - but the issue was a transient one, so it’s hard to say for sure.
The speech response didn’t help. I went ahead and opened an issue.
Yeah, not sure how that will be solved. It’s a very unique issue. Most people have a response in the first intent.
Just as a side note, I changed all my ‘intents’ to routines in alexa. Much better voice control imo.
I’m not sure I understand this sentence. Even if I include a response in the intent (it’s just one script and a speech: block), I get the timeout error.
I’ll take a look at routines - I’d been using intents so that I could have Google Assistant trigger the same code without building twice.
Oh, I thought you said it didn’t. Disregard then.
Just enable the script in alexa and have a routine run that script.
I only just added it yesterday. As a test. But that didn’t change anything.
I’ve let that bit of my configuration languish a bit… I haven’t made many changes as new enhancements were made. So I’m using emulated hue and intent_scripts for everything. I probably need to clean that all up and simplify.
Taking a look, it seems like routines are a lot easier than doing all of the skill updating in the Alexa Dev console! Looks nice.
Do routines support a “slot” variable like skills do. For instance, I have a skill where I can tell HA to play a playlist on a media_device by giving the playlist’s name.
Oh man, alexa smart home skill is 100% better than emulated hue. You actually get new devices and the phrases are fluid, unlike emulated hue. 100% recommend switching, even with the minor delays that it adds.
I personally wanted to switch away from intents immediately. I can’t even get my wife (or anyone that visits) to use the correct names of devices let alone having them say “alexa, tell home assistant to xyz”. Holy shit was that annoying. Simpler it is for them, the better.
No, that’s the downside. No slots, but with the Alexa Smart Home Skill, the need for intents is greatly reduced. It can handle media_players, covers, doors, temperature sensors, switches, lights, and a few other domains with fluid phrases. For example, I can turn the volume up on my tv my saying “alexa, turn up tv” instead of “alexa, ask home assistant to increase the volume”.
I have a bunch of “launch requests” in my setup. So I can say “Alexa, time for bed” instead of “Alexa, tell home assistant time for bed”.
It looks like I can do that with routines. And it looks like I can do the reverse and have Alexa watch something like a binary sensor to trigger a routine. Ug, got some work to do…
Huh, never heard of those. I’ll take a look.
Not a surprise that you haven’t - the Alexa stuff is all over the place.
Got the cloud Alexa integration set up and now kicking off the scripts as routines. No errors! And easier to change behavior. Thanks for the tip on that.