Alas there is the first problem.
@Dom_Nate was asking about what was going on. I stuck my nose in and started to reply.
Then @Steve-Mcl posted.
That's where the bigger picture of confusion set in.
Yes, there is a node-red-contrib-hystesis
node, but there is also one in another set.
node-red-contrib-edge-trigger
which also includes a hysteresis node.
The first one is poorly maintained, the second one a lot better.
So, cutting to my curiosity I wanted to play with the node and see what happens.
Understanding that there is a hysteresis
node and with the understanding that there is also a threshold
node that can be used.
The flow:
[{"id":"b4212ac4.d972f8","type":"random","z":"2a10ff07.234f98","name":"","low":"15","high":"25","inte":"true","property":"payload","x":210,"y":1170,"wires":[["cf807902.29ddf8","94aebf13.2f94d"]]},{"id":"f96a0bfc.f37e8","type":"inject","z":"2a10ff07.234f98","name":"foo","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":1170,"wires":[["b4212ac4.d972f8"]]},{"id":"cf807902.29ddf8","type":"hysteresis","z":"2a10ff07.234f98","name":"","rising_threshold":"18","falling_threshold":"22","initial_edge":"any","x":400,"y":1170,"wires":[["686091ce.31cbf8"]]},{"id":"94aebf13.2f94d","type":"debug","z":"2a10ff07.234f98","name":"Random","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":200,"y":1130,"wires":[]},{"id":"686091ce.31cbf8","type":"debug","z":"2a10ff07.234f98","name":"Output ************","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":580,"y":1170,"wires":[]},{"id":"d6c2287d.71b5d8","type":"inject","z":"2a10ff07.234f98","name":"","topic":"Upper Threshold","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":1030,"wires":[["cf807902.29ddf8"]]},{"id":"6895b86a.6ca8d","type":"inject","z":"2a10ff07.234f98","name":"","topic":"Lower Threshold","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":1070,"wires":[["cf807902.29ddf8"]]},{"id":"1d954b62.b5da45","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"17","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1250,"wires":[["cf807902.29ddf8"]]},{"id":"9a66d04a.d5f598","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"18","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1290,"wires":[["cf807902.29ddf8"]]},{"id":"f533bb99.e755a","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"19","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1330,"wires":[["cf807902.29ddf8"]]},{"id":"486b5dda.5637f4","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1370,"wires":[["cf807902.29ddf8"]]},{"id":"38173ab.97e34c6","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"21","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1410,"wires":[["cf807902.29ddf8"]]},{"id":"c519a2f1.5d8808","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"22","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1450,"wires":[["cf807902.29ddf8"]]},{"id":"1e3f63b5.b7746c","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"23","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1490,"wires":[["cf807902.29ddf8"]]},{"id":"da65dfa6.beffb","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1530,"wires":[["cf807902.29ddf8"]]},{"id":"94b989eb.2a7ca8","type":"inject","z":"2a10ff07.234f98","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":1210,"wires":[["cf807902.29ddf8"]]}]
This is using the node which comes in: node-red-contrib-edge-trigger
.
The random
part wasn't really working but I put it in at the start hoping for something I shouldn't.
given 18
and 24
are the two values:
If I inject: 17
, 17
, 1
I get only one 17
coming out.
Ok, That is below the 18
value. Why are they all filtered? (Rhetorical at this point)
Then I inject 19
, 19
, 19
and only get one 19
.
That value is between the 18
and 24
, so maybe they should be blocked.
But! Considering how I read the definition, the results are in congruent.
1:
Ok, so my take is that you have two values - an upper and lower - and if you get values which are below the lower, you get the inputs reflected on the output.
When the input is between the lower and upper, no output is seen.
OR it could be read as:
2:
If the values are below the lower limit, only the first one is passed to the output.
If the values are between the lower and upper, all inputs are reflected on the output.
The node does neither.
I don't know which of the two above assertions is correct - if either.
Continuing on from what I did with the inject
node/s on the flow I posted, I then injected:
23
, 23
, 30
. nothing came out.
Then I injected 21
and got 21
at the output.
Nah, something is wrong, and I accept I don't understand.
I can read until the cows come home. It is not matching what I am seeing.
I slightly modified the flow
Only for appearance.
Here is an example of what I see, so there is no arguing: