Adds hysteresis function to node-red
npm install node-red-contrib-hysteresismsg.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
Upper Threshold and Lower Threshold. Both values have to be valid float numbers.
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.
Raise error on missing threshold will create an error object in case the threshold is missing and Topic Current value arrives. This can be handled via a Catch node. Also see the included examples
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.
Original Payload / Topic or custom values can be specified.
Status node. Also see the included examples for a how-to.