# Set blinking state for LED while door is closing

**URL:** https://discourse.nodered.org/t/set-blinking-state-for-led-while-door-is-closing/89282
**Category:** General
**Created:** [5 July 2024 06:06 UTC](https://discourse.nodered.org/t/set-blinking-state-for-led-while-door-is-closing/89282 "2024-07-05T06:06:02Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [5 July 2024 08:34 UTC](https://discourse.nodered.org/t/set-blinking-state-for-led-while-door-is-closing/89282/4 "2024-07-05T08:34:00Z")

</div>

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.

 ![FSM_garage_door](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40baedd6730475b557441ef0cec109a59fac8206.png)  
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...

> [@One-button garage - help](https://discourse.nodered.org/t/one-button-garage-help/66354/3):
>
> Thanks for the reply. I try to be clearer. The garage is operated by a single button, which if pressed When closed, opens the garage. When open it closes it. From the state of opening or closing it stops it. so: if during opening or closing I press the button, it stops. the following action on the door closing or opening button (reverses the previous command). I would like to open and close the garage and monitor the status (at least to know that it is open) and for this purpose I have p…

---

_[View the full topic](https://discourse.nodered.org/t/set-blinking-state-for-led-while-door-is-closing/89282)._
