I work with a text to speech reader, so groovy just isn’t workable for me, but, yeah, I think this would be pretty easy.
I do exactly this with a motion sensor in a box, so that a hand wave over the sensor unlocks the door. But I was able to do that just with a Hello Home Action.
In your case, you want to capture the accelerometer report, rather than motion detected.
@tslagle13 might be able to point you to an answer.