# Help with message handling

**URL:** <https://discourse.nodered.org/t/help-with-message-handling/31032>\
**Category:** General\
**Created:** [2 August 2020 02:08 UTC](https://discourse.nodered.org/t/help-with-message-handling/31032 "2020-08-02T02:08:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 August 2020 02:08 UTC](https://discourse.nodered.org/t/help-with-message-handling/31032/1 "2020-08-02T02:08:04Z")

</div>

So far:  
I have the basic flow working and all is fine as intended.

It has the capacity to pass all messages or pass the message only if it is different to the previous one.  
That way it is only showing changes to the condition. This helps if it is supposed to be only one state and only for very infrequent changes to the other.

Un thought of problem:  
It is constantly changing from one state to the other at a fairly sharp frequency.

I am wanting to get something which will see the incoming messages and if they go to the _preferred_ state and stay there for a time: then it sends a signal saying that the fluctuations have stopped.

I'm guessing a `trigger` node is needed - as I am typing this message.

Definitions:  
The frequency of scanning is 30 seconds. (or there about).  
I want to see ...... 5 good messages come through before saying all is well.

So.... 5 x 30 = 150 seconds.  
I set the `trigger` node to 160 and all should be good yes?  
No, I don't think that will work. Because when the `trigger` node is `reset` it doesn't send the other message.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 August 2020 03:05 UTC](https://discourse.nodered.org/t/help-with-message-handling/31032/2 "2020-08-02T03:05:25Z")

</div>

This seems to do the trick

```auto
[{"id":"2fd2df00.32bd82","type":"inject","z":"28c631fa.7e866e","name":"Up","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Trigger","payloadType":"str","x":1930,"y":1500,"wires":[["6be76fbd.60a2a8"]]},{"id":"26b69eeb.7beeba","type":"inject","z":"28c631fa.7e866e","name":"Down","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1930,"y":1460,"wires":[["6be76fbd.60a2a8","4afa5371.55dbd4"]]},{"id":"4afa5371.55dbd4","type":"change","z":"28c631fa.7e866e","name":"Down","rules":[{"t":"set","p":"payload","pt":"msg","to":"<font color = \"red\"> <i class=\"fa fa-bullseye fa-2x\" ></i></font>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2080,"y":1460,"wires":[["4e847f8.853a1","277ab31a.9a1ffc"]]},{"id":"6be76fbd.60a2a8","type":"counter","z":"28c631fa.7e866e","name":"","init":"0","step":"1","lower":"","upper":"","mode":"increment","outputs":2,"x":2090,"y":1500,"wires":[["6abc662f.01328"],[]]},{"id":"6abc662f.01328","type":"switch","z":"28c631fa.7e866e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"trend","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":2080,"y":1540,"wires":[["f5c61b91.338a7"]]},{"id":"f5c61b91.338a7","type":"change","z":"28c631fa.7e866e","name":"Up","rules":[{"t":"set","p":"payload","pt":"msg","to":"<font color = \"lime\"> <i class=\"fa fa-bullseye fa-2x\" ></i></font>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":2240,"y":1540,"wires":[["4e847f8.853a1","277ab31a.9a1ffc"]]},{"id":"277ab31a.9a1ffc","type":"ui_text","z":"28c631fa.7e866e","group":"e43d0f47.4366a","order":1,"width":"1","height":"1","name":"UP LINK TREND","label":"","format":"{{msg.payload}}","layout":"row-center","x":2280,"y":1460,"wires":[]},{"id":"aba45435.49ff78","type":"change","z":"28c631fa.7e866e","name":"Flow.trend","rules":[{"t":"set","p":"trend","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1960,"y":1620,"wires":[["b46d510e.86ef08"]]},{"id":"bc48af86.92719","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":1790,"y":1580,"wires":[["aba45435.49ff78"]]},{"id":"21a73841.2ecd28","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":1790,"y":1620,"wires":[["aba45435.49ff78"]]},{"id":"d955e02d.cf47f","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":1790,"y":1660,"wires":[["aba45435.49ff78"]]},{"id":"b46d510e.86ef08","type":"debug","z":"28c631fa.7e866e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":2150,"y":1620,"wires":[]},{"id":"4e847f8.853a1","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2260,"y":1420,"wires":[]},{"id":"e43d0f47.4366a","type":"ui_group","z":"","name":"Uplink Status","tab":"28faaa71.a32846","order":2,"disp":true,"width":"10","collapse":false},{"id":"28faaa71.a32846","type":"ui_tab","z":"675e227d.d158b4","name":"BedPi Telemetry","icon":"track_changes","order":1,"disabled":false,"hidden":false}]

```

---

<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 August 2020 03:05 UTC](https://discourse.nodered.org/t/help-with-message-handling/31032/3 "2020-08-16T03:05:44Z")

</div>

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