# MQTT garage door opener with Node-RED

**URL:** <https://discourse.nodered.org/t/mqtt-garage-door-opener-with-node-red/33162>\
**Category:** General\
**Created:** [22 September 2020 06:27 UTC](https://discourse.nodered.org/t/mqtt-garage-door-opener-with-node-red/33162 "2020-09-22T06:27:59Z")\
**Posts on this page:** 1\
**Showing post:** 23

<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:** [23 September 2020 05:23 UTC](https://discourse.nodered.org/t/mqtt-garage-door-opener-with-node-red/33162/23 "2020-09-23T05:23:15Z")

</div>

I think your application probably lends itself to using a Finite State Machine (FSM) as you go from one state to another depending on events/conditions. I'm busy until the weekend, but as soon as I have a spare moment I'll rough-out some ideas for you. In the meantime, here's a link to a FSM I created for a Block Signalling scheme 'simulation' for the forum member... @Trying_to_learn.

[Block Signalling scheme (simulation)](https://discourse.nodered.org/t/is-anyone-here-interested-in-train-signals-and-how-they-work/19759/24)

The FSMs are written in Javascript and are located in the 'function' blocks. In your application you would only need one FSM.

Note:  
@cflurin created 'node-contrib-dsm' which removes some of the complexity of writing a FSM.

---

_[View the full topic](https://discourse.nodered.org/t/mqtt-garage-door-opener-with-node-red/33162)._
