I am trying to make a simple Rule - Turn on lights(via Echo Speaks) if there is motion. Turn off lights if no motion for 2 mins...will the below work? What seems wrong, or any edge conditions I am missing?
The timeout on your wait event will make the lights turn off either after 2 minutes or once the sensor becomes inactive, which ever comes first.
You want to instead add a wait for a 2 minute time event between your current wait and your voice command to turn off the lights.
As an alternative to the above, Rule 5.0 introduced a "duration" option on "Wait for condition." So, you could also do:
voiceCmdAsText(...)
Wait for condition: motion sensor playroom inactive --> duration: 0:02:00
voiceCmdAsText(...)
The other way of doing this (which you'll have to use if you're still using Rule 4.1, but it still works in Rule 5.0) is what @Sebastien suggested and would look like this:
voiceCmdAsText(...)
Wait for event: motion sensor playroom inactive
Wait for event: elapsed time --> 0:02:00
voiceCmdAsText(...)
Both approaches take advantage of the fact that retriggers cancel waits, so in both cases, the lights will not turn off if motion becomes active again in the meantime--the timer gets "reset."
Thanks! Let me try this out.