Control Hysteresis via dashboard inputs

I need an help to know if we can control the hysteresis values from the dhashboard inputs?

The scenario is if I can make use of slider or text input given in the dashboard that can dictate the range in the hysteresis?

For Eg: Initially I have a hysteresis for a upper limit of 2 and lower limit of 1, then I would like to change the limits to 6 and 5 for upper and lower limits respectively. Can I provide this in the dashboard and make use for controlling?

I am new to Node-RED and if in case this is a silly question, please don't get frustrated.
Thank you in advance for the help.

Are you using a specific node and want to control the hystersis? If so then which node.

This one has support from changing the hysteresis via a message, so you could link that to dashboard fields.

I am using an inject node to provide the input of sensor reading to the hysteresis.

Can I have an input along with this for the upper and lower thresholds?
for eg: the input of sensor measures the pressure to be in a range of 0.2 to 0.25 bar. So there are 2 hysteresis given 1. for range 0.18 to 0.2 and 2. for range 0.25 to 0.27.

When the pressure falls below 0.2 bar, I switch on my blower to increase the pressure, and when the pressure goes beyond 0.25, I switch on the pressure relief value, to reduce the pressure.

so, here my pressure is maintained between 0.2 and 0.25.

If in case I want to change my pressure, to a value that is lower than 0.2 or higher than 0.25, I have to change the values given in the Hysteresis. Am I right?
Without changing this I think I am cannot have control on my Pressure. (correct me if I am wrong)!

So, is there an easy way to provide inputs in the dashboard, to change the upper and lower thresholds from a dahboard, as others might not be familiar with the Node-red interior programming and I want to make it easy to control.

You didn't answer that question. Are you using node-red-contrib-hystersis, or one of the other hysteresis nodes or are you doing it with core nodes?

I am using the fixed hysteresis node from the node-red.

I recognise that node. Have you installed a specific node for that? Are you using Home Assistant?

No I am not using home assistant. and I have the node red on my hardware and the version of node red I have is v0.17.5. It is very very old version.

And I cannot instal new nodes as they affect the hardware too.

In that case we need to find out which node it is. Please open the help pane for that node and copy/paste the text here. That may help.

Provides a hysteresis or deadband function.


When a message arrives, the node will evaluate if the msg.payload is above a defined Upper Threshold or below a Lower Threshold , while taking into account the previous value. Whenever this happens a msg is send to the output. Following rules do apply:

  • msg.payload is greater than previous msg.payload AND msg.payload greater or equal Upper Threshold then send output
  • msg.payload is lesser than previous msg.payload AND msg.payload lesser or equal Lower Threshold then send output
  • msg.payload is greater than Lower Threshold but lower than Upper Threshold do nothing
  • Once a threshold has been hit, no new output will be send until the respective opposite threshold is triggered

Fixed versus Dynamic Thresholds

In the node settings either fixed or dynamic threshold can be specified.

Fixed Thresholds

Fixed thresholds allows to directly specify a Upper Threshold and Lower Threshold . Both values have to be valid float numbers.

Dynamic Thresholds

Dynamic thresholds expect following settings:

  • Topic Threshold specifies a message topic under which a triggering point is send as msg.payload .
  • Topic Current specifies a message topic under which the current values are send. This values are then matched against the respective thresholds.
  • Hysteresis+ is the upper delta for the triggering point. The msg.payload from Threshold Topic plus the Hysteresis+ value equals the Upper Threshold .
  • Hysteresis- is the lower delta for the triggering point. The msg.payload from Threshold Topic minus the Hysteresis- value equals the Lower Threshold .

Note: The values set in dynamic mode will not survive a node-red deploy or restart.

Send initial message

After starting node-red or deploying the flow, the hysteresis node does not know any previous values nor is able to determine the direction how the values develop. Send initial message will simply match the first valid value against the lower or upper limit and send an output if any of the levels is exceeded respectively underran.

Output Options

In the node Output settings either Original Payload / Topic or custom values can be specified.

Use cases

In control systems, hysteresis can be used to filter signals so that the output reacts less rapidly than it otherwise would, by taking recent history into account. For example, a thermostat controlling a heater may switch the heater on when the temperature drops below A, but not turn it off until the temperature rises above B. For instance, if one wishes to maintain a temperature of 20 °C then one might set the thermostat to turn the heater on when the temperature drops to below 18 °C and off when the temperature exceeds 22 °C.

Similarly, a pressure switch can be designed to exhibit hysteresis, with pressure set-points substituted for temperature thresholds.

That appears to be node-red-contrib-hysteresis

As it says in the help text (though maybe not very clearly), if you configure Dynamic mode then you can specify the hysteresis + and - as delta values from the target, and you can specify a topic to be used to pass in target values, and another to pass in current pressure values. So for your requirement you could set the thresholds to 0.01 and pass in target values of 0.19 or 0.26. Then for a target of 0.19 it will use thresholds of 0.18 and 0.20 and for target of 0.26 it will use thresholds of 0.25 and 0.27

1 Like