# RBE node is driving me crazy

**URL:** <https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073>\
**Category:** General\
**Created:** [30 January 2021 21:40 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073 "2021-01-30T21:40:43Z")\
**Posts on this page:** 20\
**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:** [30 January 2021 21:40 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/1 "2021-01-30T21:40:44Z")

</div>

I have been in this scenario before many times and it keeps _biting_ me.

This is a cut down of the code:

```auto
[{"id":"49a576ab.8b2ca","type":"function","z":"28c631fa.7e866e","name":"","func":"msg1 = {};\n\nvar state = context.get(\"state\") || 0;\nvar ST = global.get(\"SCAN_TIME\") || 20000;\nST = ST * 3;\n\nnode.status({text:state});\n\nif (msg.payload == true)\n{\n // All good\n msg.reset = true;\n if (state == 0)\n {\n msg.delay = ST;\n msg1.payload = \"UP\";\n context.set(\"state\",1);\n return [msg,msg1];\n } else\n {\n //\n return;\n }\n} else\n{\n // Not good.\n context.set(\"state\",0);\n return [msg,null];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":2880,"y":3540,"wires":[["4a303edf.9aa9c","37dc2ac4.5548ee"],["4599ebcb.53e71c"]],"outputLabels":["down","up"]},{"id":"4a303edf.9aa9c","type":"trigger","z":"28c631fa.7e866e","name":"","op1":"","op2":"DOWN","op1type":"nul","op2type":"str","duration":"6","extend":false,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":3050,"y":3540,"wires":[["3158e797.e96b58","4599ebcb.53e71c"]]},{"id":"37dc2ac4.5548ee","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":3040,"y":3490,"wires":[]},{"id":"857736ed.1d2248","type":"inject","z":"28c631fa.7e866e","name":"Set","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"false","payloadType":"bool","x":2780,"y":3610,"wires":[["49a576ab.8b2ca"]]},{"id":"4599ebcb.53e71c","type":"rbe","z":"28c631fa.7e866e","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":3175,"y":3600,"wires":[["650497f.77a79e8"]],"l":false},{"id":"4e386a22.f3a044","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":2590,"y":3500,"wires":[["eac9160a.7ca4e8","49a576ab.8b2ca"]]},{"id":"a6a8a370.b5112","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":2590,"y":3460,"wires":[["49a576ab.8b2ca","eac9160a.7ca4e8"]]},{"id":"3158e797.e96b58","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":3250,"y":3520,"wires":[]},{"id":"650497f.77a79e8","type":"debug","z":"28c631fa.7e866e","name":"STATUS","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":3220,"y":3640,"wires":[]},{"id":"40cda74e.116b2","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"UP","payloadType":"str","x":2740,"y":3660,"wires":[["4599ebcb.53e71c"]]},{"id":"12f72dc3.7f50b2","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"DOWN","payloadType":"str","x":2740,"y":3700,"wires":[["4599ebcb.53e71c"]]},{"id":"faafb247.909de","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FOO","payloadType":"str","x":2740,"y":3740,"wires":[["4599ebcb.53e71c"]]},{"id":"eac9160a.7ca4e8","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2890,"y":3490,"wires":[]}]

```

Picture:

 ![Screenshot from 2021-01-31 08-10-42](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/a/9abfb7f9779a913c3c8fb9807d28d7b6c439dbdb.png)

Basics:  
A `true` or `false` signal is received denoting the condition. `true` is good. `false` is bad.

All things being _good_ I get `true` signals every ..... (what ever).  
the `function` node sees what is received and if `true` sends a `msg.reset` out to stop the `trigger` node if it was active. I'll explain that now.

So, if a `false` signal is received, the `trigger` node is activated and waits for a while before sending the message.  
**IF** in the mean time, a `true` comes in, the `trigger` node is reset.

Great.

I am testing new stuff and so I am looking at this part of the code.

# Or more so:

This part isn't working as expected.

Well, it is here, but not in the REAL part of the flow, and there is _SFA_ difference. Just a rearrangement of the nodes and a couple of _extra_ ones deleted. (FAN) Ok, one, not a couple.

Now, weirdly if I export the _whole_ block and put it on another machine - more powerful - it works. As is.

If I duplicate it and put it else where on the same machine: It works.  
I cut it down to basic nodes only to allow more people to be able to import it and (maybe) help me.

But that's just it! If I duplicate the code and put it else where on the machine - and simulate the input signals: It works.

As is it doesn't.

The `RBE` isn't letting the `DOWN` signal get through.

Here is a set of screen shots showing you what I see with the real code:

This has the IP set to **fail** and we are watching the code of interest on the screen.

 ![Screenshot from 2021-01-31 08-21-36](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/71570e67370b488cb304fec0f21c314d470d64aa.png)

Here you can see the `trigger` node has been started and waiting `60` seconds.

 ![Screenshot from 2021-01-31 08-22-02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c3d474d865c6cc3b4d836289aa32bfd2b132546.png)

And the next message comes through.....

 ![Screenshot from 2021-01-31 08-22-24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8f61e3c8a7167462a7f493776087de91ff576f42.png)

And now you can see the `trigger` node has timed out.  
(No more blue dot under it.)  
But the `STATUS` node still says `UP`.  
It should say `DOWN` as that is the message send.

 ![Screenshot from 2021-01-31 08-22-43](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/f/3f97b8aad6bd3106a0e5c864c6266b2fdaa7faa5.png)

What is going on?

Here is a better picture showing better messages:

 ![Screenshot from 2021-01-31 08-43-48](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c61f5cb13024b0b64a56204cf965df637813ec4e.png)

And for the sake of "all cards on the table", here is that part of the code:

```auto
[{"id":"d0d076af.aade6","type":"link in","z":"28c631fa.7e866e","name":"Uplink status 1","links":["99fec739.577a4","ca7b2a2f.da6688"],"x":1415,"y":860,"wires":[["d2c6f62.6b59b88","b98ad199.c3b2e"]]},{"id":"d2c6f62.6b59b88","type":"debug","z":"28c631fa.7e866e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1570,"y":830,"wires":[]},{"id":"b98ad199.c3b2e","type":"function","z":"28c631fa.7e866e","name":"","func":"msg1 = {};\n\nvar state = context.get(\"state\") || 0;\nvar ST = global.get(\"SCAN_TIME\") || 20000;\nST = ST * 3;\n\nnode.status({text:state});\n\nif (msg.payload == true)\n{\n // All good\n msg.reset = true;\n if (state == 0)\n {\n msg.delay = ST;\n msg1.payload = \"UP\";\n context.set(\"state\",1);\n return [msg,msg1];\n } else\n {\n //\n return;\n }\n} else\n{\n // Not good.\n context.set(\"state\",0);\n return [msg,null];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":1560,"y":880,"wires":[["c641c733.ddcf08","41bda798.8375c"],["975da5db.6f47f","7acbe605.7ed528"]],"outputLabels":["down","up"]},{"id":"c641c733.ddcf08","type":"trigger","z":"28c631fa.7e866e","name":"","op1":"","op2":"DOWN","op1type":"nul","op2type":"str","duration":"60","extend":false,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1740,"y":880,"wires":[["975da5db.6f47f","402174e8.1add24"]]},{"id":"41bda798.8375c","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1720,"y":830,"wires":[]},{"id":"975da5db.6f47f","type":"fan","z":"28c631fa.7e866e","name":"","x":1615,"y":930,"wires":[["c7efedf1.7e7a8"]],"l":false},{"id":"f6d46866.3ebf28","type":"inject","z":"28c631fa.7e866e","name":"Set","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"false","payloadType":"bool","x":1460,"y":950,"wires":[["b98ad199.c3b2e"]]},{"id":"7acbe605.7ed528","type":"debug","z":"28c631fa.7e866e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1650,"y":1060,"wires":[]},{"id":"402174e8.1add24","type":"debug","z":"28c631fa.7e866e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1930,"y":860,"wires":[]},{"id":"c7efedf1.7e7a8","type":"rbe","z":"28c631fa.7e866e","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1685,"y":930,"wires":[["99f3baf.756be48","15467e2.0e01c82"]],"l":false},{"id":"68edec51.fb5b24","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"UP","payloadType":"str","x":1420,"y":1000,"wires":[["975da5db.6f47f"]]},{"id":"c0f5029e.6f1c1","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"DOWN","payloadType":"str","x":1420,"y":1040,"wires":[["975da5db.6f47f"]]},{"id":"68a0f3f2.511754","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FOO","payloadType":"str","x":1420,"y":1080,"wires":[["975da5db.6f47f"]]},{"id":"99f3baf.756be48","type":"link out","z":"28c631fa.7e866e","name":"Get new public IP","links":["1723bf77.0e3771","49140757.4051e"],"x":1830,"y":930,"wires":[],"l":true},{"id":"15467e2.0e01c82","type":"debug","z":"28c631fa.7e866e","name":"STATUS","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1730,"y":970,"wires":[]}]

```

You will need `node-red-contrib-fan` for it to load.

# Update:

Here is an update.

I suspect the `RBE` node and have little choice than to test this theory.

I replaced it with this node/code (a `function` block)

```auto
[{"id":"ebf6a97d.0ea5","type":"function","z":"28c631fa.7e866e","name":"RBE","func":"var old = context.get(\"OLD\") || 0;\nvar new_value = msg.payload;\nif (old != new_value)\n{\n context.set(\"OLD\",new_value);\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1855,"y":970,"wires":[["99f3baf.756be48","15467e2.0e01c82"]],"l":false}]

```

Now look at what happens (screen shots)

Changed from good to bad.

 ![Screenshot from 2021-01-31 09-05-26](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/78c4914d37591144b1e10aa7138a1f5108e1531b.png)

Getting worse.

 ![Screenshot from 2021-01-31 09-05-45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/288bafc0ac6d9b6825a7a8f04f84985e4a9e7e9c.png)

Now it is really bad.

 ![Screenshot from 2021-01-31 09-06-07](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7d32ef9af8aba40ff4c9ce8f30988cff76a7f288.png)

And this is what should happen

 ![Screenshot from 2021-01-31 09-06-27](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b1bd26035c73c3001f2dbc4e6bb0465970a7f5ff.png)

So could someone who really knows how things work explain this to me - please.

---

<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:** [30 January 2021 22:16 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/2 "2021-01-30T22:16:56Z")

</div>

can you break this down to a simple (minimal flow - just one) with injects numbered 1, 2, 3, 4 etc - that demonstrates the issue?

There is far too much text, changes, ifs, buts & maybes in your post. It is impossible to follow.

Standard nodes only if possible.

---

<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:** [30 January 2021 22:25 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/3 "2021-01-30T22:25:21Z")

</div>

There is no `1`, `2`, `3`, input.

It is `true` and `false` inputs.

This code works:

```auto
[{"id":"49a576ab.8b2ca","type":"function","z":"28c631fa.7e866e","name":"","func":"msg1 = {};\n\nvar state = context.get(\"state\") || 0;\nvar ST = global.get(\"SCAN_TIME\") || 20000;\nST = ST * 3;\n\nnode.status({text:state});\n\nif (msg.payload == true)\n{\n // All good\n msg.reset = true;\n if (state == 0)\n {\n msg.delay = ST;\n msg1.payload = \"UP\";\n context.set(\"state\",1);\n return [msg,msg1];\n } else\n {\n //\n return;\n }\n} else\n{\n // Not good.\n context.set(\"state\",0);\n return [msg,null];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":2880,"y":3540,"wires":[["4a303edf.9aa9c","37dc2ac4.5548ee"],["4599ebcb.53e71c"]],"outputLabels":["down","up"]},{"id":"4a303edf.9aa9c","type":"trigger","z":"28c631fa.7e866e","name":"","op1":"","op2":"DOWN","op1type":"nul","op2type":"str","duration":"6","extend":false,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":3050,"y":3540,"wires":[["3158e797.e96b58","4599ebcb.53e71c"]]},{"id":"37dc2ac4.5548ee","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":3040,"y":3490,"wires":[]},{"id":"857736ed.1d2248","type":"inject","z":"28c631fa.7e866e","name":"Set","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"false","payloadType":"bool","x":2780,"y":3610,"wires":[["49a576ab.8b2ca"]]},{"id":"4599ebcb.53e71c","type":"rbe","z":"28c631fa.7e866e","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":3175,"y":3600,"wires":[["650497f.77a79e8"]],"l":false},{"id":"4e386a22.f3a044","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":2590,"y":3500,"wires":[["eac9160a.7ca4e8","49a576ab.8b2ca"]]},{"id":"a6a8a370.b5112","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":2590,"y":3460,"wires":[["49a576ab.8b2ca","eac9160a.7ca4e8"]]},{"id":"3158e797.e96b58","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":3250,"y":3520,"wires":[]},{"id":"650497f.77a79e8","type":"debug","z":"28c631fa.7e866e","name":"STATUS","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":3220,"y":3640,"wires":[]},{"id":"40cda74e.116b2","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"UP","payloadType":"str","x":2740,"y":3660,"wires":[["4599ebcb.53e71c"]]},{"id":"12f72dc3.7f50b2","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"DOWN","payloadType":"str","x":2740,"y":3700,"wires":[["4599ebcb.53e71c"]]},{"id":"faafb247.909de","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FOO","payloadType":"str","x":2740,"y":3740,"wires":[["4599ebcb.53e71c"]]},{"id":"eac9160a.7ca4e8","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2890,"y":3490,"wires":[]}]

```

(From the top of the first (only) post)

This one doesn't:

```auto
[{"id":"d0d076af.aade6","type":"link in","z":"28c631fa.7e866e","name":"Uplink status 1","links":["99fec739.577a4","ca7b2a2f.da6688"],"x":1415,"y":860,"wires":[["d2c6f62.6b59b88","b98ad199.c3b2e"]]},{"id":"d2c6f62.6b59b88","type":"debug","z":"28c631fa.7e866e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1570,"y":830,"wires":[]},{"id":"b98ad199.c3b2e","type":"function","z":"28c631fa.7e866e","name":"","func":"msg1 = {};\n\nvar state = context.get(\"state\") || 0;\nvar ST = global.get(\"SCAN_TIME\") || 20000;\nST = ST * 3;\n\nnode.status({text:state});\n\nif (msg.payload == true)\n{\n // All good\n msg.reset = true;\n if (state == 0)\n {\n msg.delay = ST;\n msg1.payload = \"UP\";\n context.set(\"state\",1);\n return [msg,msg1];\n } else\n {\n //\n return;\n }\n} else\n{\n // Not good.\n context.set(\"state\",0);\n return [msg,null];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":1560,"y":880,"wires":[["c641c733.ddcf08","41bda798.8375c"],["975da5db.6f47f","7acbe605.7ed528"]],"outputLabels":["down","up"]},{"id":"c641c733.ddcf08","type":"trigger","z":"28c631fa.7e866e","name":"","op1":"","op2":"DOWN","op1type":"nul","op2type":"str","duration":"60","extend":false,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1740,"y":880,"wires":[["975da5db.6f47f","402174e8.1add24"]]},{"id":"41bda798.8375c","type":"debug","z":"28c631fa.7e866e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1720,"y":830,"wires":[]},{"id":"975da5db.6f47f","type":"fan","z":"28c631fa.7e866e","name":"","x":1615,"y":930,"wires":[["c7efedf1.7e7a8"]],"l":false},{"id":"f6d46866.3ebf28","type":"inject","z":"28c631fa.7e866e","name":"Set","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"false","payloadType":"bool","x":1460,"y":950,"wires":[["b98ad199.c3b2e"]]},{"id":"7acbe605.7ed528","type":"debug","z":"28c631fa.7e866e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1650,"y":1060,"wires":[]},{"id":"402174e8.1add24","type":"debug","z":"28c631fa.7e866e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1930,"y":860,"wires":[]},{"id":"c7efedf1.7e7a8","type":"rbe","z":"28c631fa.7e866e","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1685,"y":930,"wires":[["99f3baf.756be48","15467e2.0e01c82"]],"l":false},{"id":"68edec51.fb5b24","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"UP","payloadType":"str","x":1420,"y":1000,"wires":[["975da5db.6f47f"]]},{"id":"c0f5029e.6f1c1","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"DOWN","payloadType":"str","x":1420,"y":1040,"wires":[["975da5db.6f47f"]]},{"id":"68a0f3f2.511754","type":"inject","z":"28c631fa.7e866e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"FOO","payloadType":"str","x":1420,"y":1080,"wires":[["975da5db.6f47f"]]},{"id":"99f3baf.756be48","type":"link out","z":"28c631fa.7e866e","name":"Get new public IP","links":["1723bf77.0e3771","49140757.4051e"],"x":1830,"y":930,"wires":[],"l":true},{"id":"15467e2.0e01c82","type":"debug","z":"28c631fa.7e866e","name":"STATUS","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1730,"y":970,"wires":[]}]

```

The `node.red.contrib.fan` is the only foreign node.

But, if I replace the `RBE` node with the code I posted:  
and the `RBE` is not foreign.

```auto
[{"id":"ebf6a97d.0ea5","type":"function","z":"28c631fa.7e866e","name":"RBE","func":"var old = context.get(\"OLD\") || 0;\nvar new_value = msg.payload;\nif (old != new_value)\n{\n context.set(\"OLD\",new_value);\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1855,"y":970,"wires":[["99f3baf.756be48","15467e2.0e01c82"]],"l":false}]

```

It works.

To me it is 100% pointing at the RBE node not doing what it should.

---

<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:** [30 January 2021 22:27 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/4 "2021-01-30T22:27:15Z")

</div>

> [@Trying\_to\_learn](#):
>
> There is no `1` , `2` , `3` , input.

I meant label your injects 1, 2, 3 etc so i know how to repeat what you are doing (what order of clicking causes the issue you see)

---

<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:** [30 January 2021 22:27 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/5 "2021-01-30T22:27:42Z")

</div>

Sorry. Ok. Hang on.

---

<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:** [30 January 2021 22:37 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/6 "2021-01-30T22:37:04Z")

</div>

> [@Trying\_to\_learn](#):
>
> This one doesn't

I see nothing wrong - it does as its supposed to (as far as I can tell).

As for the fan node - what a waste of bytes that is. You might as well have an empty change node.

---

<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:** [30 January 2021 22:55 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/7 "2021-01-30T22:55:41Z")

</div>

Here is a (maybe) better showing of the problem.

(Wait for the one that works.... coming soon)

All good.

Note the condition of the `STATUS` node as `UP`.  
and that the `OUT OF RBE` is also `UP`.  
So: RBE's last message is `UP`. (`OUT OF FAN`)

 ![Screenshot from 2021-01-31 09-33-24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0f08acd1f82c6337e9d6083fd60090e3043095ca.png)

Things start to go wrong.  
No message into `RBE` that I can see. (`OUT OF FAN`)

 ![Screenshot from 2021-01-31 09-35-23](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/019b2bd0e81d1bd5409029bff0c81abffb90e0a7.png)

They get worse.  
ditto.

 ![Screenshot from 2021-01-31 09-35-42](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e0fac9e31d2a9be3883f935725c1c160e3e79c52.png)

And worse.  
ditto.

 ![Screenshot from 2021-01-31 09-36-03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/906383aa97659d3b321e62be0e3d6144f5dd016a.png)

And now fail:  
See the new message going into the `RBE` node? `DOWN`?

 ![Screenshot from 2021-01-31 09-36-25](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/f/3f7190755b196e04ddca4ab1722849b1009245d0.png)

Note that STATUS hasn't changed from `UP` to `DOWN` yet you can see the message going into the `RBE` node quite clearly.

Now the working example:

Note the `UP` messages.

 ![Screenshot from 2021-01-31 09-41-03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7f34a09192d112fc68afcab2795833352846bced.png)

`false` received. `trigger` set off.

 ![Screenshot from 2021-01-31 09-49-44](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a52d6bf83392dacef41e82c4d420193857f73497.png)

 ![Screenshot from 2021-01-31 09-50-03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/74b05f8d2f186a8c2c42e7609df9fe8b610d636e.png)

 ![Screenshot from 2021-01-31 09-50-23](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9ec60d55725651b841ba251e369f7c38b226ddbd.png)

And now......

 ![Screenshot from 2021-01-31 09-50-45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/1/41cc3974dbc1a8d9a475dad060aeaaa43b929ab1.png)

Note the `DOWN` message in `STATUS`.

This was NOT happening before with the `RBE` node.

Is that clear enough? I am at a loss how to show you any clearer.

---

<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:** [30 January 2021 23:11 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/8 "2021-01-30T23:11:13Z")

</div>

> [@Trying\_to\_learn](#):
>
> Is that clear enough?

wow - no haha

> [@Trying\_to\_learn](#):
>
> I am at a loss how to show you any clearer

Make a flow with only the elements that matter, with injects that fire the EXACT TOPIC/PAYLOAD combinations that you see & that cause the issue you see. Number the injects in order of click - when you can reproduce your issue in a dedicated flow that we can import - _that would be easier_

  

* * *
  

This is definitely a case of not being able to see the wood for the trees.

I am **convinced** this is due to topic / payload combination.

Just checking (i'm sure you know this, but just in case...) - you do know that RBE works per topic?

e.g.

| topic | payload | RBE passes? |
| --- | --- | --- |
| _empty_ | UP | |
| 192.168.0.2 | UP | |
| 192.168.0.2 | DOWN | |
| 192.168.0.2 | DOWN | |
| _empty_ | DOWN | |
| _empty_ | DOWN | |
| _empty_ | UP | |
| 192.168.0.2 | DOWN | |
| _empty_ | UP | |
| 192.168.0.2 | DOWN | |
| _empty_ | UP | |
| 192.168.0.2 | DOWN | |
| _empty_ | UP | |

---

<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:** [30 January 2021 23:22 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/9 "2021-01-30T23:22:38Z")

</div>

Yeah, but reading the docs, the topic is.... _optional_.

I want to pass changes through it. So: irrespective of the `topic` if the message changes it is passed.

But to _digress_, honestly: you can't see how in the first set of screen grabs, the message is blocked and yet on the second set it is passed?

As I have decided to use the `function` node rather than the `RBE` node and it works with that, I guess I should just shut up and move on.

But I am repeatedly tripped on this and I have fallen for this trap many times in the past.

I am (obviously) missing something. Especially if I just replace the `RBE` node with a `function` node with the code I showed and it works.

---

<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:** [30 January 2021 23:24 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/10 "2021-01-30T23:24:17Z")

</div>

> [@Trying\_to\_learn](#):
>
> Yeah, but reading the docs, the topic is.... _optional_ .

It is optional - BUT...

- EMPTY TOPIC + PAYLOAD is one combination,
- TOPIC + PAYLOAD is a completely different combination.

again - this is what happens when you send payloads WITH and WITHOUT a topic **through 1 RBE**...

| topic | payload | RBE passes? |
| --- | --- | --- |
| _empty_ | UP | |
| 192.168.0.2 | UP | |
| 192.168.0.2 | DOWN | |
| 192.168.0.2 | DOWN | |
| _empty_ | DOWN | |
| _empty_ | DOWN | |
| _empty_ | UP | |
| 192.168.0.2 | DOWN | |
| _empty_ | UP | |
| 192.168.0.2 | DOWN | |
| _empty_ | UP | |
| 192.168.0.2 | DOWN | |
| _empty_ | UP | |

basically if you want RBE to work the same regardless of topic, change the topic to empty string `""` before the RBE.

---

<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:** [30 January 2021 23:27 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/11 "2021-01-30T23:27:03Z")

</div>

Well, to me that isn't **optional**.

Optional to me means it makes no difference if it is (or not) used.

When clearly it does make a difference.

There - maybe - should be an .... option (sorry) to include the `topic` in the filtering/parsing.

---

<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:** [30 January 2021 23:28 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/12 "2021-01-30T23:28:50Z")

</div>

> [@Trying\_to\_learn](#):
>
> There - maybe - should be an .... option (sorry) to include the `topic` in the filtering/parsing.

Perhaps - yes.

Your function...

```auto
var old = context.get("OLD") || 0;
var new_value = msg.payload;
if (old != new_value)
{
    context.set("OLD",new_value);
    return msg;
}

```

... works because you ignore topic altogether.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [30 January 2021 23:30 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/13 "2021-01-30T23:30:10Z")

</div>

Where in the docs does it describe `topic` as optional?

The docs actually say:

> `topic`  
> if specified the function will work on a per topic basis.

and

> **Note:** This works on a per `msg.topic` basis. This means that a single rbe node can handle multiple different topics at the same time.

Sorry, but I think that is reasonably clear about how it handles `msg.topic` _if_ it is set.

---

<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:** [30 January 2021 23:33 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/14 "2021-01-30T23:33:33Z")

</div>

But the docs for the `RBE` node are (as I read them)

> RBE mode will accept numbers, strings, and simple objects. Other modes must provide a parseable number.

Yes, below it says:

> if specified the function will work on a per topic basis.

But what does `specified` mean here?

If it is **set**? If it is **not blank**?  
To me - and believe me: I failed English - `specified` is the wrong word.

(Sorry: edit)

To me the `topic` is ALWAYS parsed (irrespective of if it is blank or set) and this needs to be clearly stated in the _read me_ for the 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:** [30 January 2021 23:38 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/15 "2021-01-30T23:38:56Z")

</div>

> [@Trying\_to\_learn](#):
>
> But what does `specified` mean here?

if topic is not specified (empty) then that in itself is a topic - an empty topic.

All you have to remember is, if the topic changes, its a different comparison.

Say for arguments sake, each topic is a memory bank where the last payload is remembered (like your function uses context.old) then...

- `topic : ""` - is one memory bank
- `topic : "x"` - is another memory bank
- `topic : "y"` - is yet another memory bank

Like i said before, if you want ALL payloads (regardless of topic) to be considered as the same compare, then set the topic to a consistent value before the RBE.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [30 January 2021 23:41 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/16 "2021-01-30T23:41:45Z")

</div>

> [@Trying\_to\_learn](#):
>
> But what does `specified` mean here?
> 
> If it is **set**? If it is **not blank**?

It means if `msg.topic` exists, then it will be used.

As Steve has said - if you want the node to act across all messages it receives, then all of those messages should either have `msg.topic` set to the same value, or not have `msg.topic` set at all (ie deleted from the message with a change node).

---

<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:** [30 January 2021 23:42 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/17 "2021-01-30T23:42:25Z")

</div>

Yes, I can see that and kind of understand that.

At _this particular stage_ in the flow, I guess it is academic and so the topic isn't needed.

So in that case: rather than _complicating_ things by changing the topic, why not just have an option to IGNORE it?

---

<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:** [30 January 2021 23:45 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/18 "2021-01-30T23:45:04Z")

</div>

> [@Trying\_to\_learn](#):
>
> So in that case: rather than _complicating_ things by changing the topic, why not just have an option to IGNORE it?

I dont think its complicating things (just that it tripped you up)

However, I do see a benefit to this option you propose (for different reasons to you) - it would allow a topic to be kept while acting on the payload alone.

Maybe raise it as a feature request?

---

<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:** [30 January 2021 23:45 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/19 "2021-01-30T23:45:14Z")

</div>

Yes, Nick, I (now) agree with this.

But as I just posted to Steve, why _complicate_ things?  
(Adding an extra `change` node to delete the `topic` - as an example of getting what you said done)

It would be better if there was an option in the node to simply `ignore topic`.

Otherwise it isn't **optional**. It is part of the parsing mechanism.  
By no means _optional_.

---

<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:** [30 January 2021 23:52 UTC](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073/20 "2021-01-30T23:52:06Z")

</div>

I think my confusion is that is says:

> if the topic is set........

It would be (to me) a lot clearer if it said ... (let me think)

> RBE mode will accept numbers, strings, and simple objects. Other modes must provide a parseable number.  
> The topic is also used to determine the likeness of the messages and used to determine if the messages are the same.

And/or have a tick box to just ignore the topic. (I'm hoping a bit there)

Having the `topic`'s role in a whole different paragraph separates it's importance.  
As it (the topic) isn't not part of the equation. Excuse the double negative there but I think it helps explain why/how I get confused with reading it.

The topic is just as important as the message, and so it needs to be included where/when this is stated.  
Not in a different paragraph.

[Next page](https://discourse.nodered.org/t/rbe-node-is-driving-me-crazy/40073.md?page=2)
