# Same Trigger - Different Outputs / Different Results

**URL:** <https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384>\
**Category:** Developing Nodes\
**Created:** [1 July 2026 01:08 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384 "2026-07-01T01:08:15Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sgooch](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@Sgooch](https://discourse.nodered.org/u/Sgooch)\
**Post date:** [1 July 2026 01:08 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/1 "2026-07-01T01:08:15Z")

</div>

I have a trigger that I want to turn on a light (Homeseer Device).  
If I "trigger" the trigger 🙂 with a timestamp inject results are expected. Light comes on for 15 seconds and then goes off.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/3/d31cc7ce32a9c8b3db97e458278b13e7525cc5a7.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/f/5fe86478aa1543de29a92498bd51661b9482c4e7.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c45dca5e15be806185ce82e739287fc66de5e3f5.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1dd5d6c29f073804695fd25dc0341cbb93bed29.png)  
Note the highlight in the object coming out of the trigger.

BUT! If I am using a MQQT receive. "changed" to a timestamp, then the trigger "triggers" but the object coming out of THAT trigger is a bit different and the light does not get turned on. The light object is seeing something different with this method and does not respond as expected.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb0c3bd4205b50deb18ec5545092227c63e204ad.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3a8a72d1bbe2b0a7b9d17e84fc54550898a0fa7a.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/42e8dec21ffa2a076b9e115a01c9f18323f32579.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/7472de0a29ec8ec9ac1f653f52cc400f4e0acf26.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e14cdd7cbbbef3ae87695186e3c64409264822e6.png)  
Again, note the difference between the object going to the light object with only the timestamp and then the one triggered by the MQQT.  
I am pulling my hair out trying to figure out how to get my MQQT to properly turn the light on and off with the trigger.  
ANY assistance is greatly appreciated.

---

<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:** [1 July 2026 06:13 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/2 "2026-07-01T06:13:49Z")

</div>

The frontDoor text is telling you that the msg topic is "frontDoor".  
set the debug to complete message property and it will become clearer that msg.payload is the same in both images.  
You could set the change node to delete msg.topic

---

<div class="post-metadata">

**Author:** ![Sgooch](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@Sgooch](https://discourse.nodered.org/u/Sgooch)\
**Post date:** [1 July 2026 12:35 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/3 "2026-07-01T12:35:12Z")

</div>

Thanks so much! I have no idea why I wasn't looking at the complete message in the debug. It would have been much more evident! I guess this is how we learn! Thanks again!

---

<div class="post-metadata">

**Author:** ![Sgooch](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@Sgooch](https://discourse.nodered.org/u/Sgooch)\
**Post date:** [1 July 2026 13:49 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/4 "2026-07-01T13:49:14Z")

</div>

What would be the best way to only have it trigger between sunset and sunrise? I kind of need to keep the MQQT message coming, but maybe trap somewhere before it gets to the light object itself?

---

<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:** [1 July 2026 17:51 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/5 "2026-07-01T17:51:40Z")

</div>

Search the flow library for the `chron plus` node

You can use it to output at sunset and rise, you can then set a context variable to to day or night. you can then set a switch node in your flow using the context variables as the switch property, this will means that depending on the context variable the switch can pass the incoming mqtt message or not.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 July 2026 19:34 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/6 "2026-07-01T19:34:32Z")

</div>

> [@E1cid](#):
>
> Search the flow library for the `chron plus` node

There are other nodes as well which may be easier to use. I use the sun-position nodes and have a startup flow that outputs sun and moon position every minute to MQTT so that I can use it in other flows simply by subscribing.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8fd8f48da00b80f5f147dac316dddb1bf32d58bf.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2ed2ae8380b26cc5dce96df9ae20764d461aed0f.png)

---

<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:** [1 July 2026 19:52 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/7 "2026-07-01T19:52:25Z")

</div>

> [@TotallyInformation](#):
>
> There are other nodes as well which may be easier to use.

There may be, but the cron plus is a great node and why install 2 or 3 nodes when one node does timing events etc and does it well. It also has a great selection of examples of use.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 July 2026 19:58 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/8 "2026-07-01T19:58:09Z")

</div>

> [@E1cid](#):
>
> cron plus is a great node

Sure.

> [@E1cid](#):
>
> why install 2 or 3 nodes when one node does timing events etc and does it well

Well, I prefer it because I don't need to re-read the instructions to use the sun-position nodes when I often do for CRON+. 😃 Not everyone needs or wants the complexity of CRON+ - personally, I use both but only CRON+ when I need a more complex schedule where it is worth it.

---

<div class="post-metadata">

**Author:** ![Sgooch](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@Sgooch](https://discourse.nodered.org/u/Sgooch)\
**Post date:** [2 July 2026 00:08 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/9 "2026-07-02T00:08:28Z")

</div>

All very good suggestions, but most of those are a bit overkill for what I need. I have decided to go a slightly different way I created a node from my HomeSeer (Home Automation System) that will tell me "Day" or "Night" (msg.payload.status).  
So now I guess I am asking a SLIGHTLY different question. What can I put before my trigger to either pass on my timestamp or NOT pass on my timestamp based on "Home-Front-Virtual-Night Control"?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3cd20e08e29f9f9eac160b32855314e57bfb8b57.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/904c54d4580a678eab664b1e362222068c7f36a3.png)

---

<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:** [2 July 2026 00:59 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/10 "2026-07-02T00:59:09Z")

</div>

> [@Sgooch](#):
>
> What can I put before my trigger to either pass on my timestamp or NOT pass on my timestamp based on "Home-Front-Virtual-Night Control"?

You could use a change node downstream of the your "House Front Virtual-Night Control" AKA "Home-Front-Virtual-Night Control" node to set a flow context variable.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/a/2a26f9fedc02aa60ce6e71366e933e51dc04e8be.png)

And a switch node upstream of the trigger to only pass messages when that variable equals "Night"

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/b/2b65b10256ab92648a5192544b8f38302fd92669.png)

It might be a good idea to add a second test in the switch to pass the message if the flow variable is null (ie not yet set).  
This will give you two outputs to the switch but you can wire both of them to the trigger.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/43787f5bfb9b7403e312a580a35d5e2f1d01b1f3.png)

If you don't like the resulting "spooky effect" without visible wires, there are contrib gate nodes which take control inputs to pass or block messages.

---

<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:** [2 July 2026 07:46 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/11 "2026-07-02T07:46:16Z")

</div>

> [@Sgooch](#):
>
> What can I put before my trigger to either pass on my timestamp or NOT pass on my timestamp

I use node-red-contrib-simple-gate for such tasks.

---

<div class="post-metadata">

**Author:** ![Sgooch](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@Sgooch](https://discourse.nodered.org/u/Sgooch)\
**Post date:** [2 July 2026 12:42 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/12 "2026-07-02T12:42:25Z")

</div>

> [@Colin](#):
>
> use node-red-contrib-simple-gate for such tasks.

This worked great. I have to admit I am still trying to wrap my head around how "flow.daynight" works, but I kind of get the idea. But that fact that it is working is wonderful.

I don't see a node called "node-red-contrib-simple-gate", I am guessing I need to add that to the pallet if I want to try it.

---

<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:** [2 July 2026 12:59 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/13 "2026-07-02T12:59:46Z")

</div>

> [@Sgooch](#):
>
> I am still trying to wrap my head around how "flow.daynight" works

Generally speaking, the data in Node-red is part of a message. It flows along the wires, is used or otherwise processed, then it disappears.

Context variables allow you to save some data outside of this transitory structure, for example so that you can use a value saved from another message to compare with a later message.

It can be confusing when you first start working with a flow based language, hard to grasp that a normal variable set in your javascript does not retain its value between messages.

---

<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:** [2 July 2026 14:35 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/14 "2026-07-02T14:35:07Z")

</div>

> [@Sgooch](#):
>
> I don't see a node called "node-red-contrib-simple-gate", I am guessing I need to add that to the pallet

Yes [node-red-contrib-simple-gate](https://flows.nodered.org/node/node-red-contrib-simple-gate). It allows you to block or pass messages by sending the node control messages.

Personally I try and avoid using flow and global context wherever practical. I much prefer to be able to see the links between nodes rather than the action in one node being changed by sending a message to another one.

---

<div class="post-metadata">

**Author:** ![Sgooch](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@Sgooch](https://discourse.nodered.org/u/Sgooch)\
**Post date:** [3 July 2026 16:48 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/15 "2026-07-03T16:48:25Z")

</div>

> [@Colin](#):
>
> [node-red-contrib-simple-gate](https://flows.nodered.org/node/node-red-contrib-simple-gate)

Thanks for the information on [node-red-contrib-simple-gate](https://flows.nodered.org/node/node-red-contrib-simple-gate) as it is VERY simple (once I loaded up and example piece of code). Both methods above are great, but in my situation I think the [node-red-contrib-simple-gate](https://flows.nodered.org/node/node-red-contrib-simple-gate) was the easiest. Thanks again for all the great comments and suggestions!

---

<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:** [17 July 2026 16:48 UTC](https://discourse.nodered.org/t/same-trigger-different-outputs-different-results/101384/16 "2026-07-17T16:48:42Z")

</div>

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