Can you do this with a timer

For my house I have an RFID reader at my front door, this talks via an arduino with MQTT back to openhab to allow or deny access.

Basically I have a rule:
rule “Access Control”
when Item GF_Security_Front_RFID received command
then
if(receivedCommand==“AABBCCDD”){
sendCommand(GF_Security_Front_Lock, 1)
}

What I want to do is modify that rule so that if the RFID tag is read again within x seconds, it opens the roller door

Something like:

Read 1:
Unlock the door
Start a 4 second timer

Read 2:
If timer still running
Send command to open roller door.

Can this be done?

Sure
Use the expire binding (you will have to install it if not installed)
create an unbound Switch item

Switch MyRFIDTimer { expire="1m,command=OFF" }

so… when Item GF_Security_Front_RFID received command
set the MyRFIDTimer to ON

MyRFIDTimer.sendCommand(ON)

but what we could do is check if it’s on first and open the other door if it is
so something like this maybe

rule “Access Control”
when
        Item GF_Security_Front_RFID received command
then
       if (MyRFIDTimer.state ==ON){
           // open the roller door
        }  else {
           MyRFIDTimer.sendCommand(ON)
           if(receivedCommand==“AABBCCDD”){
               sendCommand(GF_Security_Front_Lock, 1)
            }
        }
end

here is more help
Expire binding documentation

Rich explains unbound items

You can also achieve this in node red without the virtual item by using a flow variable to store the first use of the RFID trigger and a delay node to reset it after an amount of time. I just configured something almost identical to activate different scenes by repeatedly hitting the same button on a switch.

Thanks all - I ended up being able to get this simply sorted with the Expire add-on - Works a treat!