Set blinking state for LED while door is closing

I built a control system for my garage door 4-years ago using a Finite State Machine (FSM).

I installed two microswitches to detect when the door was fully open or fully closed. These signals were detected by a Wemos D1 Mini which sent the "state" to Node-RED using MQTT.

I also re-purposed a broken key-fob and connected it an output pin on the Wemos so I could "simulate" someone pressing the key-fob. My garage door is a bit dumb as once you have told it to "open" it will continue that operation until the door is fully open. If during that time you press the key-fob it will "stop" and if you press the key-fob again it will reverse its direction of travel and start "closing". A similar sequence happens when I tell the door to close. I think this is for safety reasons so if the door encounters an obstacle it will "stop" immediately. I mimicked that behaviour in the FSM mainly so I could also use Alexa to control the door.

Here's a screenshot of the state diagram showing the transitions.


If I was tackling the project again, I dare say I could arrange to flash an LED during state S1 or S3 using a non-blocking delay or equivalent.

I think I may have written this up as a Project and shared it on the forum.

EDIT: Found it...