I've checked many questions on Alexa routines but could not find any related to how routines work at the back end. Well we are using AWS API gateway with lamda proxy integration and you should know that AWS lambdas are stateless services. That is, if a single endpoint is hit by two separate api calls, the scope of one lambda copy will not be aware that there is another copy triggered at the same time or a few mili seconds after. So, this is not compatible to how routines work and I am surprised that they didn't keep this in mind as both services belong to AWS. I'll explain the problem we are facing and we'll be happy to provide our customers with a work around. We have configured a Smart Home skill which has three main intents power, mode, temp. There are voice commands that support all of the three at a time but we need to provide our consumers with a routine set for voice command 'Alexa, Good Morning'. In case user opts to add two actions to the routine trigger, one for power change and other for temp change. This can only be done with two separate actions.
if we add a routine and want to power on and set temperature to say 70, when the event occurs, we receive two separate payloads for power on and temperature 70. In the integrated lambda, we check that AC should be powered ON before setting any temperature or mode value because many ACs manufacturers do not work for temp and mode commands even with remote until and unless the AC is first powered ON. So, what happens is, Alexa sends power on and without waiting for us to update the state it sends the temp command which causes the temp command failure as power state is still off in DB. and some times we receive the temp change command before the power on command which again fails the temp command.
Can this be changed as this is a flaw which will fail with many manufacturer AC/Heat Pumps. Also, if we change our logic according to how Alexa routine works then it wont remain compatible with the manufacturers we are supporting. And if we don't change, then we might not get the works with Alexa badge. This problem is actually very serious.
Second problem we are facing is that, if user multiple actions to be performed on trigger event, then on api the request by alexa is not sent in same sequence. e.g. if i had first added action for temp to 70 then second action for temp 71 and third for temp 72, then i expect the temp to chnage in given sequence but it performs actions randomly.
Third, please tell us if there is any flag/identifier from which we can identify whether the directive received in api request came from routine or normal action.