# Queue or gate or function

**URL:** https://discourse.nodered.org/t/queue-or-gate-or-function/21774
**Category:** General
**Created:** [16 February 2020 08:57 UTC](https://discourse.nodered.org/t/queue-or-gate-or-function/21774 "2020-02-16T08:57:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![debouttek](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@debouttek](https://discourse.nodered.org/u/debouttek)
#### Post date: [16 February 2020 08:57 UTC](https://discourse.nodered.org/t/queue-or-gate-or-function/21774/1 "2020-02-16T08:57:42Z")

</div>

Need some advice on the direction that I need to search for.

I have a MQTT node with msg.payload ON that stays ON for 3 sec and then goes OFF until MQTT sends out a new message. (Motion sensor)

Sometimes when the sun is shining harder the motion sensor is triggered and I get false messages.

So I would like to delay or trigger or gate or Queue. I don't know.

So only when MQTT sends longer than 5 seconds there has to be an output otherwise the message needs to be skipped.

Delay works but does not skip when message is lower than 5 seconds.

Any ideas?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [16 February 2020 09:50 UTC](https://discourse.nodered.org/t/queue-or-gate-or-function/21774/2 "2020-02-16T09:50:07Z")

</div>

A trigger node set to send Nothing immediately, Wait for 5 seconds, Then Send orginal message, Reset Trigger if msg.payload = "OFF".

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [16 February 2020 12:06 UTC](https://discourse.nodered.org/t/queue-or-gate-or-function/21774/3 "2020-02-16T12:06:35Z")

</div>

Just to add to this - you might want to add in a switch node that will let the OFF messages bypass the trigger node

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/d/1d372126c31fcb8ed69c7108c9d0d852f9351b0a.png)

And if you don't want to get multiple OFF messages - then add an RBE node into the mix as well

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5cb146f885285484b9a15f827fb35006e128bfdd.png)

---

<div class="post-metadata">

### Author: ![debouttek](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@debouttek](https://discourse.nodered.org/u/debouttek)
#### Post date: [16 February 2020 19:20 UTC](https://discourse.nodered.org/t/queue-or-gate-or-function/21774/4 "2020-02-16T19:20:21Z")

</div>

Cymplecy

I did a test with the second example and this looks OK.  
Thanks.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [16 April 2020 19:20 UTC](https://discourse.nodered.org/t/queue-or-gate-or-function/21774/5 "2020-04-16T19:20:23Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
