# Extend a trigger without triggering it

**URL:** <https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699>\
**Category:** General\
**Created:** [5 April 2021 11:07 UTC](https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699 "2021-04-05T11:07:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)\
**Post date:** [5 April 2021 11:07 UTC](https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699/1 "2021-04-05T11:07:09Z")

</div>

In the bedroom I have two presence sensors: PIR and Audio. Both are wired directly into a Trigger node used in "wait for" and "extend delay" mode. The lights turn on if there is movement or noise, and they stay on for a period of time after those things have ceased.

How can I make the lights turn on ONLY when there is movement, but have the trigger extend when there is noise (and movement)?

I guess this is not possible with the Trigger node, as the only inputs are `delay` and `reset`, there is no `extend`.

Is there an elegant solution, perhaps using another node?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 April 2021 11:23 UTC](https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699/2 "2021-04-05T11:23:41Z")

</div>

Have you tried enabling the "extend delay if new message arrives"?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/4403bb19267697025a4ea138c06631d94705ccba.png)

![AZtKOSzJBz](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/de00620ec9ea45266df3478d917703a08482dcdd.gif)

I'm pretty sure that satisifies your question "Extend a trigger without triggering it"

---

<div class="post-metadata">

**Author:** ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)\
**Post date:** [5 April 2021 11:26 UTC](https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699/3 "2021-04-05T11:26:41Z")

</div>

Hi Steve, that's how I have it set up already. Problem with that is the audio would also turn on the light in the first place, I don't want it to - I just want it to extend the time the light is turned on.

i.e.  
PIR -\> trigger AND extend  
Audio -\> extend only

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 April 2021 11:30 UTC](https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699/4 "2021-04-05T11:30:09Z")

</div>

Ah. I see. That was a little unclear (to me). Ok so add a memory flag...

 ![RP79VjXhix](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/46b1ad0713d1b248ef530347034ca5efe308d1f1.gif)

Demo flow...

```auto
[{"id":"a2749959.e0c2a8","type":"trigger","z":"a86654ec.266648","name":"","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"3","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":876,"y":736,"wires":[["9fcad2c0.f7ee"]]},{"id":"f29ce16c.80426","type":"inject","z":"a86654ec.266648","name":"PIR","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":690,"y":704,"wires":[["a2749959.e0c2a8"]]},{"id":"c422f53d.f4a8c8","type":"inject","z":"a86654ec.266648","name":"AUDIO","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":752,"wires":[["d00ff19c.5ee9d"]]},{"id":"7a62d5fe.7e521c","type":"debug","z":"a86654ec.266648","name":"Light","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1218,"y":736,"wires":[]},{"id":"9fcad2c0.f7ee","type":"change","z":"a86654ec.266648","name":"","rules":[{"t":"set","p":"light1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1056,"y":736,"wires":[["7a62d5fe.7e521c"]]},{"id":"d00ff19c.5ee9d","type":"switch","z":"a86654ec.266648","name":"is light1 on?","property":"light1","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":694,"y":752,"wires":[["a2749959.e0c2a8"]]}]

```

---

<div class="post-metadata">

**Author:** ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)\
**Post date:** [5 April 2021 11:36 UTC](https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699/5 "2021-04-05T11:36:37Z")

</div>

Perfect, that works really well! After you posted that I thought another idea would be to take the output from the trigger node, feed it into a gate node, feed in the audio input to the gate node, and feed the output back in to the trigger node. Although I prefer the simplicity of your version.

---

<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:** [4 June 2021 11:37 UTC](https://discourse.nodered.org/t/extend-a-trigger-without-triggering-it/43699/6 "2021-06-04T11:37:22Z")

</div>

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