# Trigger on 2 non-simultaneous inputs

**URL:** <https://discourse.nodered.org/t/trigger-on-2-non-simultaneous-inputs/94263>\
**Category:** General\
**Created:** [31 December 2024 03:22 UTC](https://discourse.nodered.org/t/trigger-on-2-non-simultaneous-inputs/94263 "2024-12-31T03:22:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daxliniere](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daxliniere/32/42187_2.png) [@daxliniere](https://discourse.nodered.org/u/daxliniere)\
**Post date:** [31 December 2024 03:22 UTC](https://discourse.nodered.org/t/trigger-on-2-non-simultaneous-inputs/94263/1 "2024-12-31T03:22:56Z")

</div>

Hey everyone,  
Yes, it's me again. I just can't seem to get my head around how to deal with multi-input conditionals in NodeRed.  
I have a flow which messages me if a door is left open for longer than 3 minutes (using a Trigger node). I would like to get another message when the door is eventually closed.

In my mind, I'd have a new node that was connected to the output of the 3-minute Trigger node and the output of the door switch node. If it received TRUE from the output of the Trigger node, then the new node would start listening to the door switch node and when a FALSE (closed) was received it would send a message.

What would be the best way to achieve this?

Happy new year,  
Dax.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 December 2024 08:35 UTC](https://discourse.nodered.org/t/trigger-on-2-non-simultaneous-inputs/94263/2 "2024-12-31T08:35:43Z")

</div>

You could bypass the trigger and reset it and use a filter node.

```auto
[{"id":"449387a4bb6fbe05","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":150,"y":7800,"wires":[["7ca0a89a50dc4668"]]},{"id":"7ca0a89a50dc4668","type":"trigger","z":"d1395164b4eec73e","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"false","bytopic":"all","topic":"topic","outputs":1,"x":340,"y":7800,"wires":[["a203938da5027e6b"]]},{"id":"3b7c015f5db82fb5","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":150,"y":7860,"wires":[["a203938da5027e6b","7ca0a89a50dc4668"]]},{"id":"a203938da5027e6b","type":"rbe","z":"d1395164b4eec73e","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":530,"y":7800,"wires":[["9e8a0d270c935eaf"]]},{"id":"9e8a0d270c935eaf","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{#payload}}The door has been open some time{{/payload}}{{^payload}}The door is closed{{/payload}}","output":"str","x":680,"y":7800,"wires":[["c7105a45c5dcf4c2"]]},{"id":"c7105a45c5dcf4c2","type":"debug","z":"d1395164b4eec73e","name":"debug 2576","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":7920,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 December 2024 08:40 UTC](https://discourse.nodered.org/t/trigger-on-2-non-simultaneous-inputs/94263/3 "2024-12-31T08:40:34Z")

</div>

> [@daxliniere](#):
>
> the new node would start listening to the door switch node and when a FALSE (closed) was received it would send a message.

IMHO that's the wrong way to think of a Node-red program.  
Use the "door closed" message that you already get.

You don't say if the door only sends a message when it's state changes open to closed or vice versa, or if it continually sends messages.

If it's the former, this might work - shows a single open, delay, closed cycle.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/3/6385d769852103bd639ea8c5c11ffc228f517d95.png)

If it's the latter, just put a filter in front of the output to only pass changed messages.

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

Edit: Interesting. Similar but different to @E1cid's approach.

---

<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:** [31 March 2025 08:41 UTC](https://discourse.nodered.org/t/trigger-on-2-non-simultaneous-inputs/94263/4 "2025-03-31T08:41:22Z")

</div>

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