Bug in RBE node?

The rbe node has a mode "block if value change greater than".

(It also as a similar "greater or equal" mode, but here I am referring explicitly to the "greater than" mode only, without any "or equal" addition.)

I want to use it to let only messages pass that contain the same value as the previous incoming message. Therefore I configure the rbe node to "block if value change greater than" 0 "compared to last input value".

The effect is that the rbe node does not let any message pass, at all.

If I change the comparison for the value change from 0 to e.g. 0.000000000001, then it works as intended.

edit:
This is a minimal example demonstrating the problem, pasted as suggested below:

[{"id":"480ae6de.258fb","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"5f7764b8.b5ffb4","type":"inject","z":"480ae6de.258fb","name":"","topic":"","payload":"0.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":80,"wires":[["b852b54b.f343c8"]]},{"id":"b3b69bb1.4fa6","type":"inject","z":"480ae6de.258fb","name":"","topic":"","payload":"2.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":91.08332824707031,"y":139.41665649414062,"wires":[["b852b54b.f343c8"]]},{"id":"dc7c3ce7.aeed48","type":"debug","z":"480ae6de.258fb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":180,"wires":[]},{"id":"b852b54b.f343c8","type":"rbe","z":"480ae6de.258fb","name":"Block if value change > 0.0000000000000000000000001","func":"narrowband","gap":"0.0000000000000000000000001","start":"2.5","inout":"in","property":"payload","x":407.00001525878906,"y":111.83334350585938,"wires":[["dc7c3ce7.aeed48"]]},{"id":"d111d796.eca5b","type":"inject","z":"480ae6de.258fb","name":"","topic":"","payload":"0.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":240,"wires":[["ed07bc1a.acaa38"]]},{"id":"ef05fc10.d1b778","type":"inject","z":"480ae6de.258fb","name":"","topic":"","payload":"2.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":91.08332824707031,"y":299.4166564941406,"wires":[["ed07bc1a.acaa38"]]},{"id":"ed07bc1a.acaa38","type":"rbe","z":"480ae6de.258fb","name":"Block if value change > 0","func":"narrowband","gap":"0","start":"2.5","inout":"in","property":"payload","x":307.00001525878906,"y":271.8333435058594,"wires":[["dc7c3ce7.aeed48"]]},{"id":"1f1f8b99.67968c","type":"comment","z":"480ae6de.258fb","name":"Blocks messages unless payload is the same as in previous received message","info":"","x":390,"y":40,"wires":[]},{"id":"dbef54fd.73e498","type":"comment","z":"480ae6de.258fb","name":"Should behave the same but does not","info":"","x":310,"y":320,"wires":[]}]

Is this a bug in the rbe node?

You can paste flows here.

```
your code
```

I imagine its a unknown feature :slight_smile:

(as no-one else has ever tried to use the RBE node to only pass messages that are the same as the previous one - this being the complete opposite of its primary function :slight_smile: )

Reported here: https://github.com/node-red/node-red-nodes/issues/569

I'm confused.

From the start, it won't have a "previous" value. (I'll let that one go)
It gets a message and only passes messages there after that are the same.

Errrr. That doesn't quite make sense.

Here's my take on how to do it.

[{"id":"c35c4d03.0524c8","type":"inject","z":"9c1e5490.5d70b","name":"","topic":"","payload":"0.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":80,"wires":[["a4ebf5d4.1abc48"]]},{"id":"7985036a.c6a44c","type":"inject","z":"9c1e5490.5d70b","name":"","topic":"","payload":"2.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":91.08332824707031,"y":139.41665649414062,"wires":[["a4ebf5d4.1abc48"]]},{"id":"320aebe6.5993e4","type":"debug","z":"9c1e5490.5d70b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":580,"y":180,"wires":[]},{"id":"570bc977.c880d","type":"comment","z":"9c1e5490.5d70b","name":"Blocks messages unless payload is the same as in previous received message","info":"","x":390,"y":40,"wires":[]},{"id":"a4ebf5d4.1abc48","type":"function","z":"9c1e5490.5d70b","name":"Try this","func":"if (msg.topic == \"SET\")\n{\n    context.set(\"value\",msg.payload);\n    return;\n}\nvar x = context.get(\"value\");\nif (x == msg.payload)\n{\n    return msg;\n}\nreturn;","outputs":1,"noerr":0,"x":320,"y":180,"wires":[["320aebe6.5993e4"]]},{"id":"9e4739c2.691818","type":"inject","z":"9c1e5490.5d70b","name":"Set this value as comparison","topic":"SET","payload":"0.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":230,"wires":[["a4ebf5d4.1abc48"]]}]

With this flow you can set what it is you want the value to be.

Press the two inject nodes a few times to see nothing gets through.
Then press the "set up" node.
Then press the other two inject nodes and see what happens.

The simple workaround is to use a switch instead, but the bug has now been fixed and released as 0.2.5

Thanks for the fix!

Good day everyone,

I am not sure if this is still part of the bug or if i'm doing something wrong..
My sensors transmit a value every 10 seconds.
They are display in a chart.
To limit the data stored by the chart, I wanted to use narrow band node.

Here is my flow:

[{"id":"2c96ef15.787dc","type":"mqtt in","z":"5707306e.2d6e5","name":"","topic":"smartmeter/actualrecieved","qos":"2","datatype":"auto","broker":"4ca37cc1.bcc8d4","x":130,"y":200,"wires":[["9d0465e.8e11d98"]]},{"id":"915430cb.681a8","type":"mqtt in","z":"5707306e.2d6e5","name":"","topic":"cost/m3-10min","qos":"2","datatype":"auto","broker":"4ca37cc1.bcc8d4","x":100,"y":160,"wires":[["90c2315e.7efc"]]},{"id":"ce070521.461c38","type":"change","z":"5707306e.2d6e5","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Stroom","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":200,"wires":[["c8079ab8.8d6c68","5005cd8.b80a934"]]},{"id":"54a1b584.98edcc","type":"change","z":"5707306e.2d6e5","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"gas","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":160,"wires":[["c8079ab8.8d6c68","25ad73cd.da5fec"]]},{"id":"c8079ab8.8d6c68","type":"ui_chart","z":"5707306e.2d6e5","name":"","group":"505fecf2.202164","order":1,"width":"14","height":"7","label":"Stroom & Gas Gebruik","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"5","removeOlder":"8","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1000,"y":180,"wires":[[]]},{"id":"624252f5.d6be9c","type":"rbe","z":"5707306e.2d6e5","name":"","func":"narrowband","gap":"2","start":"1","inout":"out","property":"payload","x":650,"y":160,"wires":[["54a1b584.98edcc"]]},{"id":"eb438423.b441b8","type":"rbe","z":"5707306e.2d6e5","name":"","func":"narrowband","gap":"0.2","start":"1","inout":"out","property":"payload","x":650,"y":200,"wires":[["ce070521.461c38"]]},{"id":"df6f5c1e.62f6c","type":"calculator","z":"5707306e.2d6e5","name":"","inputMsgField":"payload","outputMsgField":"payload","operation":"div","constant":"1000","x":490,"y":200,"wires":[["eb438423.b441b8"]]},{"id":"5005cd8.b80a934","type":"debug","z":"5707306e.2d6e5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":220,"wires":[]},{"id":"25ad73cd.da5fec","type":"debug","z":"5707306e.2d6e5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":140,"wires":[]},{"id":"90c2315e.7efc","type":"function","z":"5707306e.2d6e5","name":"","func":"msg.payload = Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":160,"wires":[["624252f5.d6be9c"]]},{"id":"9d0465e.8e11d98","type":"function","z":"5707306e.2d6e5","name":"","func":"msg.payload = Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":200,"wires":[["df6f5c1e.62f6c"]]},{"id":"4ca37cc1.bcc8d4","type":"mqtt-broker","z":"","name":"Rasp4 MQTT","broker":"192.168.86.73","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"505fecf2.202164","type":"ui_group","z":"","name":"Gebruik","tab":"25fc57.0f52d3aa","order":2,"disp":false,"width":"14","collapse":false},{"id":"25fc57.0f52d3aa","type":"ui_tab","z":"","name":"Electriciteit","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

The narrow band after "smartmeter/actualrecieved works.
But the narrow band after cost/m3-10min lets everything through.

Numbers 0 and higher without a decimal don't work.
If I set the node to a value of 0.1, it's okay, but value 1 doesn't work.