# Feature request for RBE node

**URL:** <https://discourse.nodered.org/t/feature-request-for-rbe-node/42809>\
**Category:** Feature Requests\
**Created:** [18 March 2021 10:58 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809 "2021-03-18T10:58:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rekcodocker](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rekcodocker/32/31833_2.png) [@rekcodocker](https://discourse.nodered.org/u/rekcodocker)\
**Post date:** [18 March 2021 10:58 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/1 "2021-03-18T10:58:19Z")

</div>

situation:  
I have sensor which gives a lot of output, and it logs to a graph.  
Many points will slow down the graph, and the output does not change often - but when it does I want to see it.

I use the RBE node to reduce the amount of data in the graph, but:  
If the value does not change for 5 hours and then suddenly spikes, I get an ugly and incorrect interpolation from the last point (5 hours ago) to the new spike-value. It shows a slope over 5 hours when in reality, the signal was steady and only spiked after 5 hours.

Feature request:  
Can you make the RBE node either

- so that it outputs some values, like at least every N seconds, or at least every Nth value?  
It would be in effect a data-reducer but not a 100% limiter.
- or so that when the value changes it quickly outputs the last 'normal' value, followed by the spike? That way graph- interpolation would be correct.

---

<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:** [18 March 2021 11:07 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/2 "2021-03-18T11:07:33Z")

</div>

You can achieve this with a trigger node after the RBE...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/05d7aa02b5e1a4d7ae0f71ee10e8300541dcf911.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2021 11:12 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/3 "2021-03-18T11:12:00Z")

</div>

Or maybe a Delay node in Rate Limit mode would be better for you, rather than an RBE node.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2021 11:21 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/4 "2021-03-18T11:21:29Z")

</div>

Or this function, which combines a Rate Limit and RBE so that the output is limited to a certain rate unless the input changes, in which case the new value is sent immediately.

```auto
onst minInterval = 5000 // min interval between outputs, msec
const previous = context.get("previous") || {timestamp: 0}
const now = new Date().getTime()
if ( msg.payload == previous.value && (now - previous.timestamp) < minInterval )
{
    // same value as last one and too soon to send again, so send nothing
    msg = null
} else {
    previous.timestamp = now
    previous.value = msg.payload
    context.set("previous", previous)
}
return msg;

```

---

<div class="post-metadata">

**Author:** ![rekcodocker](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rekcodocker/32/31833_2.png) [@rekcodocker](https://discourse.nodered.org/u/rekcodocker)\
**Post date:** [18 March 2021 11:26 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/5 "2021-03-18T11:26:11Z")

</div>

Cool! I use trigger nodes but I had not thought of this!!

---

<div class="post-metadata">

**Author:** ![rekcodocker](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rekcodocker/32/31833_2.png) [@rekcodocker](https://discourse.nodered.org/u/rekcodocker)\
**Post date:** [18 March 2021 11:27 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/6 "2021-03-18T11:27:56Z")

</div>

No, that won't work, but thanks.  
It's interesting to me when the value changes.  
Rate limit will simply drop messages regardless of their value.

---

<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:** [18 March 2021 11:32 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/7 "2021-03-18T11:32:24Z")

</div>

> [@rekcodocker](#):
>
> I use the RBE node to reduce the amount of data in the graph, but:  
> If the value does not change for 5 hours and then suddenly spikes, I get an ugly and incorrect interpolation from the last point (5 hours ago) to the new spike-value. It shows a slope over 5 hours when in reality, the signal was steady and only spiked after 5 hours.

A step line chart might be better than sending unnecessary duplicate points.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/b/bbc99b99ed191252f8767141278777bb7d80d765.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/2/c2af58063a17cfd42e5d7655ae13202f3a40c043.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 March 2021 11:50 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/8 "2021-03-18T11:50:40Z")

</div>

> [@rekcodocker](#):
>
> Rate limit will simply drop messages regardless of their value.

The function I posted solves that problem. The trigger node solution has the potential problem that if the sensor fails so that it stops sending data then the graph will keep going as if there is good data. The function will only keep sending values provided data keeps coming in. Whether that matters depends on your requirement.

---

<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:** [18 March 2021 12:48 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/9 "2021-03-18T12:48:44Z")

</div>

The step option in the graph node is the simplest answer

---

<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:** [17 May 2021 12:49 UTC](https://discourse.nodered.org/t/feature-request-for-rbe-node/42809/10 "2021-05-17T12:49:29Z")

</div>

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