I’d look to handling this in the code of the app rather than in the devise type.
What I would look at doing is subscribing to when the sensor is opened and closed. When it’s opened use change a state variable to false, and then when close run a procedure in a minute to change the state.
Something like this:
def doorSensorOpen(evt) {
state.doorClosed = false
}
When the door opens, we change the state variable to false.
def doorSensorsClose(evt) {
runIn(60, closeState)
}
def closeState() {
state.doorClosed = true
}
What this does is when the door closes, it schedule the ‘closeState’ procedure to run in 60 seconds. This gives a 1 minute for the accelerator time to stop moving.
Then in your procedure where you run the actions when acceleration happens, put in a conditional:
def accelerationCheck {
if (state.doorClosed = true) {
Insert you code to do stuff here
}
}
That way you need acceleration AND the variable needs to say closed. And that won’t say closed until the door has been closed for at least a minute.