Assync timer, event with wait command that let other event with wait command to execute at same time


#1

1) Give a description of the problem
Hi,
I have an alexa skill (my own built) that send a web request to pass some value to a piston. But I want to use it inside a routine and the routine is restricted the way the data is managed. So the alexa routine start by setting a switch to on. Then, the skills ask the delay for the timer and send the information to the piston that save it as global variable.

To be short, the piston have an event with the switch, so when it turns on, it set a local variable to 1. Then if the web request did not comes, I want to reset that local variable to 0.

If the web request had works, I want another switch to be on for the delay in the global variable (set from the web request).

2) What is the expected behaviour?
The timer_switch turn on, wait 2 minutes and then check if $arg still unchanged for 2 minutes, if so, reset that switch to off. While this part is running, the web request comes to set the global value and start the ‘timer’ and turn on the main switch. After the delay, turn back the switch to off.

3) What is happening/not happening?
everything works fine exept 1 big thing… The $arg timer must finish before the other timer starts. So the main timer is always late and also the local variable have the time to come back to 0 so the logic is worthless!

4) Post a Green Snapshot of the pistonimage



Just look at the 2 last events of the piston, all the other are scheduled one…


#2

[solved]
I just capture the time of the event, add 2 minutes, store it inside variable and use time action (every day at myvariable).