# Stop interval trigger with msg.reset

**URL:** <https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305>\
**Category:** General\
**Created:** [6 April 2020 07:49 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305 "2020-04-06T07:49:23Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 07:49 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/1 "2020-04-06T07:49:23Z")

</div>

I have a function node, f1, which triggers a trigger node so that it (the trigger node) starts generating pulses according to an interval. The pulses trigger another function node, f2, which simulates data for a given time period. When the simulation is done, f2 should somehow tell the trigger node to stop generating the pulse, and according to the trigger node this is done by sending a message with the reset property set. The problem is that the trigger node can't receive input from two different sources.... How do I solve this?

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [6 April 2020 08:09 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/2 "2020-04-06T08:09:06Z")

</div>

> [@mansahlgren](#):
>
> The problem is that the trigger node can't receive input from two different sources

Why not? I have triggers with 4 different sources.

Maybe you can show us what you got so fare.

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 08:12 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/3 "2020-04-06T08:12:25Z")

</div>

Oh, really? I tried connecting multiple inputs and the program stopped responding and then there was ”unexpected error”. Not at the computer right now, can take a printscreen soon.

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 09:26 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/4 "2020-04-06T09:26:19Z")

</div>

![error](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/88221fbbc35d14b710d527c2e8181718375fefc3.png)

I forgot there is a switch also. I added a wire from MoveLaglyftare0 back to "resend every 1000ms" and now, everytime i try to trigger the flow with an inject node, nothing happens, the program stop responding, and then "unexpected error (504)".

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [6 April 2020 10:48 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/5 "2020-04-06T10:48:33Z")

</div>

Which is f1 and which is f2? Also you now have a loop where every second you are sending a message to the function node. What happens if you chang the time from 1000ms to 5000ms? You will still have an infinate loop but resourcse may be freed up to allow it to run.

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 10:50 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/6 "2020-04-06T10:50:46Z")

</div>

SetContextVars = f1. MoveLaglyftare0 = f2.

I dont understand. It's not supposed to be an infinite loop because f2 should tell the triggernode to stop after a while.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [6 April 2020 10:55 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/7 "2020-04-06T10:55:50Z")

</div>

Put a `debug` node on the output of the 'SetContextVars' node and the top output of the `switch` and show what is happening.

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 11:03 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/8 "2020-04-06T11:03:23Z")

</div>

Nothing happens. No response.

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 11:20 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/9 "2020-04-06T11:20:01Z")

</div>

It works, after a little change in the flow, on my local red node installation but still not on the Ec2 on AWS... I guess there is something with my EC2.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [6 April 2020 11:48 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/10 "2020-04-06T11:48:09Z")

</div>

do you realize what you just said makes no sense to me?

> It works, after a little change in the flow,  
> but you don't say what you changed

> still not on the Ec2 on AWS  
> and just what might that be?

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 12:02 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/11 "2020-04-06T12:02:50Z")

</div>

You are right. But I dont think it matters because it obviously has nothing to do with the flow that I built since the same flow works on my local machine and not on the EC2.

When I copied the flow from EC2 to my local machine it started giving outputs, which the EC2 didnt. So the only difference is the installation and the os on which NodeRed is run. What specifically could cause this? There is no error ouput as I said.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [6 April 2020 12:08 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/12 "2020-04-06T12:08:02Z")

</div>

What is an EC2?  
What version of NR and node.js is it running?

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 12:14 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/13 "2020-04-06T12:14:27Z")

</div>

An (edit:)ubuntu AWS-server.

Node-RED version: v0.19.5  
Node.js version: v10.19.0

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [6 April 2020 14:29 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/14 "2020-04-06T14:29:29Z")

</div>

And what version of NR are you running on your Pi?

---

<div class="post-metadata">

**Author:** ![mansahlgren](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mansahlgren](https://discourse.nodered.org/u/mansahlgren)\
**Post date:** [6 April 2020 14:42 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/15 "2020-04-06T14:42:46Z")

</div>

On ubuntu, not pi:

Node-RED version: v1.0.3  
Node.js version: v12.16.1

I guess I should upgrade the ones on Ec2...

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [6 April 2020 15:26 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/16 "2020-04-06T15:26:11Z")

</div>

That's where I would start....might want to update the Pi too.

---

<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:** [5 June 2020 15:26 UTC](https://discourse.nodered.org/t/stop-interval-trigger-with-msg-reset/24305/17 "2020-06-05T15:26:18Z")

</div>

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