Help me with my Skywriter project

Hello, I’ve been looking into making a door that is unlocked with a 4 gesture “pin” using the Skywriter and a raspberry pi. So my question is, is it possible to set up so the pi is always listening for a 4 gesture input, if it matches the set pin, it’ll flash a green led, then switch on a 5v relay connected to the gpio, then after 5-10 seconds switch the relay back off. If it doesn’t match the set pin, it’ll just flash a red led.