# Report by Exception (RBE) node not working as expected

**URL:** <https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986>\
**Category:** General\
**Created:** [20 January 2022 19:23 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986 "2022-01-20T19:23:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![henzard](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henzard/32/54679_2.png) [@henzard](https://discourse.nodered.org/u/henzard)\
**Post date:** [20 January 2022 19:23 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/1 "2022-01-20T19:23:43Z")

</div>

I would expect 80 to pass then 89 to pass but then 80 should fail. So only keeping the highest value until it's reset.

```auto
[
    {
        "id": "781440cf8f7577ec",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "8aebf30f.53c138",
        "type": "inject",
        "z": "781440cf8f7577ec",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "r",
        "payload": "80",
        "payloadType": "str",
        "x": 370,
        "y": 260,
        "wires": [
            [
                "26b409ab.f80dae"
            ]
        ]
    },
    {
        "id": "4ff87952.259528",
        "type": "inject",
        "z": "781440cf8f7577ec",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "r",
        "payload": "89",
        "payloadType": "str",
        "x": 370,
        "y": 320,
        "wires": [
            [
                "26b409ab.f80dae"
            ]
        ]
    },
    {
        "id": "40a1a7dc.1e3318",
        "type": "debug",
        "z": "781440cf8f7577ec",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 790,
        "y": 280,
        "wires": []
    },
    {
        "id": "26b409ab.f80dae",
        "type": "rbe",
        "z": "781440cf8f7577ec",
        "name": "",
        "func": "deadband",
        "gap": "1",
        "start": "",
        "inout": "out",
        "septopics": false,
        "property": "payload",
        "topi": "topic",
        "x": 580,
        "y": 280,
        "wires": [
            [
                "40a1a7dc.1e3318"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 January 2022 19:30 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/2 "2022-01-20T19:30:08Z")

</div>

No - you have it set

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/ca090d5c97cd3097a7d9f3056af4bb6222ce697e.png)  
so first 80 goes through... any more 80 values will not- then you send 89... and that goes through...  
As it's a valid value them any value that is a change of size more than 1 will trigger it - so 80 is 9 away so that goes through.

---

<div class="post-metadata">

**Author:** ![henzard](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henzard/32/54679_2.png) [@henzard](https://discourse.nodered.org/u/henzard)\
**Post date:** [21 January 2022 08:16 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/3 "2022-01-21T08:16:05Z")

</div>

So the idea is to use it for a Scale. As you get on the scale the value wil rise. Then it wil peak, as you then get off all the lower values should be blocked as they are not greater than the last valid output.

---

<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:** [21 January 2022 08:28 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/4 "2022-01-21T08:28:00Z")

</div>

You could achieve this via a function node.

![chrome_LwfwXuKSLM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d0105a5d0783a38e8beb846e51b3551aaa071642.gif)

```auto
[{"id":"8f7f9a59772e9c54","type":"inject","z":"23a4d2dd73b6359f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"30.1","payloadType":"num","x":510,"y":600,"wires":[["4b61f945350d10d6"]]},{"id":"4b61f945350d10d6","type":"function","z":"23a4d2dd73b6359f","name":"Max Value Monitor","func":"let max_value = context.get(\"max_value\") || 0;\nconst current_value = msg.payload;\nif(msg.topic == \"CLEAR\") {\n max_value = 0;\n context.set(\"max_value\", undefined);\n node.status({fill:\"grey\",shape:\"ring\",text:\"---\"});\n} else {\n if (max_value < current_value) {\n max_value = current_value;\n context.set(\"max_value\", max_value);\n msg.payload = max_value;\n node.status({fill:\"blue\",shape:\"dot\",text: max_value + \" kg\"});\n return msg;\n } else {\n node.status({ fill: \"grey\", shape: \"ring\", text: max_value + \" kg\" });\n }\n}\n\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":750,"y":640,"wires":[["159f9dcabd276f59"]]},{"id":"159f9dcabd276f59","type":"debug","z":"23a4d2dd73b6359f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":950,"y":640,"wires":[]},{"id":"db507ead0e26e1af","type":"inject","z":"23a4d2dd73b6359f","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CLEAR","x":500,"y":540,"wires":[["4b61f945350d10d6"]]},{"id":"bfc7179f7006d97b","type":"inject","z":"23a4d2dd73b6359f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"37.81","payloadType":"num","x":510,"y":640,"wires":[["4b61f945350d10d6"]]},{"id":"4d2375f2dfe18c0a","type":"inject","z":"23a4d2dd73b6359f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"44.8","payloadType":"num","x":510,"y":680,"wires":[["4b61f945350d10d6"]]},{"id":"6e47c151fc9cae40","type":"inject","z":"23a4d2dd73b6359f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"63.45","payloadType":"num","x":510,"y":720,"wires":[["4b61f945350d10d6"]]}]

```

@henzard - the flow has been updated to fix a slight issue around the CLEAR operation (credit to @UnborN )

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 January 2022 08:58 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/5 "2022-01-21T08:58:40Z")

</div>

The smooth node can also has a report maximum mode (and can be reset)

---

<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:** [21 January 2022 09:00 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/6 "2022-01-21T09:00:09Z")

</div>

I must spend some time with the smooth node 🤔

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 January 2022 09:03 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/7 "2022-01-21T09:03:20Z")

</div>

I'm sure it could benefit from some of your love and attention 🙂

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [21 January 2022 09:22 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/8 "2022-01-21T09:22:06Z")

</div>

Nice solution ..

it looks like it needs an extra line of code to fully reset on a CLEAR msg  
by settings the Context to undefined to clear it and make the code ready for new values

```auto
if (msg.topic == "CLEAR") {
    max_value = 0;
    context.set("max_value", undefined); // reset context
    node.status({ fill: "grey", shape: "ring", text: "---" });
} else {
...

```

---

<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:** [21 January 2022 09:29 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/9 "2022-01-21T09:29:45Z")

</div>

Good spot - was a hurried demo adapted from something else. I'll update the post.

---

<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:** [4 February 2022 09:29 UTC](https://discourse.nodered.org/t/report-by-exception-rbe-node-not-working-as-expected/56986/10 "2022-02-04T09:29:47Z")

</div>

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