Editable Edge Trigger

I'm working on a fermentation management system for a commercial winery using IOT4 MQTT devices to monitor temperature and control solenoid valves for controlling the flow of cold water. In order to do that, I need to set edge triggers for the top and bottom range I want to maintain temperature in. I'll also be building a dashboard for this and want to have editable edge triggers. Everything I've seen so far for edge trigger node options only allows for static assignment of the set-points within the node itself. Does anyone have a way of dynamically assigning the edge trigger temperatures? Anyone have a good example of something like this that I could combine with node-red-contrib-edge-detector or node-red-contrib-edge-trigger to make those trigger temps editable?

Attached is my current test design with falling and rising edges of 10 and 17 which converts the msg payload to a 0 or 1 to turn the valve on or off via MQTT. That's all working correctly and I have the temperature coming in via MQTT and writing to InfluxDB as well. I'll link that to the edge triggers later - this is just for testing. This is my first Node-Red project and I'm really impressed by all it can do.

Hi and welcome to the forum.

I can't find that node in the library.

And the limits on the other ones are annoying, but not impossible to work around.

If you are only using the rising and falling edge and not the hysteresis node you can work around this easily enough.

I get that you are new here and are limited to how many posts you can make in the first couple of days.

I'll go away and make an EXAMPLE flow to show you a way to get around it.
(Back soon)

This may (or not) do what you want.

But it should give you enough of a model to see what I am doing and allow you to tweak it to do what you want.

IMPORTANT
You must set an upper and lower value first.
Then press the example value.

[{"id":"1391aea053d0b763","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11","payloadType":"num","x":160,"y":3460,"wires":[["ab38a0c438852e21"]]},{"id":"e28aed7312460bb9","type":"comment","z":"7e987ddf260bdf0d","name":"Upper limit","info":"","x":170,"y":3410,"wires":[]},{"id":"71b7c4a538659240","type":"comment","z":"7e987ddf260bdf0d","name":"Lower limit","info":"","x":540,"y":3410,"wires":[]},{"id":"cfa2e0312fd1d286","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"12","payloadType":"num","x":160,"y":3500,"wires":[["ab38a0c438852e21"]]},{"id":"7c8ae1ee774304e2","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"13","payloadType":"num","x":160,"y":3540,"wires":[["ab38a0c438852e21"]]},{"id":"79b639b13389a50d","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":530,"y":3450,"wires":[["a13c908cc2a78060"]]},{"id":"6b1dd7effd8b13e6","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":530,"y":3490,"wires":[["a13c908cc2a78060"]]},{"id":"43c766be1a5df05c","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":530,"y":3530,"wires":[["a13c908cc2a78060"]]},{"id":"ab38a0c438852e21","type":"change","z":"7e987ddf260bdf0d","name":"","rules":[{"t":"set","p":"upper","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":3460,"wires":[[]]},{"id":"a13c908cc2a78060","type":"change","z":"7e987ddf260bdf0d","name":"","rules":[{"t":"set","p":"lower","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":3450,"wires":[[]]},{"id":"bbd53fa092d0bb58","type":"comment","z":"7e987ddf260bdf0d","name":"Example Real time values","info":"","x":220,"y":3590,"wires":[]},{"id":"f1b03f28eace87e9","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":160,"y":3630,"wires":[["d84e6f051c3797f9"]]},{"id":"084fa00f00b06c0e","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":160,"y":3670,"wires":[["d84e6f051c3797f9"]]},{"id":"ef2c0598f1b58063","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":160,"y":3710,"wires":[["d84e6f051c3797f9"]]},{"id":"8101479fee05cb8d","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":160,"y":3750,"wires":[["d84e6f051c3797f9"]]},{"id":"d5278eb76663d965","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":160,"y":3790,"wires":[["d84e6f051c3797f9"]]},{"id":"ee93a6eee365aa37","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":310,"y":3630,"wires":[["d84e6f051c3797f9"]]},{"id":"6938bc8c4444f712","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":310,"y":3670,"wires":[["d84e6f051c3797f9"]]},{"id":"6046c5de03f00523","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":310,"y":3710,"wires":[["d84e6f051c3797f9"]]},{"id":"d04201212261678e","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"9","payloadType":"num","x":310,"y":3750,"wires":[["d84e6f051c3797f9"]]},{"id":"dfac70ac840a4185","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":310,"y":3790,"wires":[["d84e6f051c3797f9"]]},{"id":"b0f1adfe843b6938","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11","payloadType":"num","x":450,"y":3630,"wires":[["d84e6f051c3797f9"]]},{"id":"62e6cd64cddd4e0d","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"12","payloadType":"num","x":450,"y":3670,"wires":[["d84e6f051c3797f9"]]},{"id":"f5296e20e2128fd2","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"13","payloadType":"num","x":450,"y":3710,"wires":[["d84e6f051c3797f9"]]},{"id":"f9800ecdbcab8e5a","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"14","payloadType":"num","x":450,"y":3750,"wires":[["d84e6f051c3797f9"]]},{"id":"6556b8f102074047","type":"inject","z":"7e987ddf260bdf0d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"15","payloadType":"num","x":450,"y":3790,"wires":[["d84e6f051c3797f9"]]},{"id":"d84e6f051c3797f9","type":"change","z":"7e987ddf260bdf0d","name":"","rules":[{"t":"set","p":"upper","pt":"msg","to":"upper","tot":"flow"},{"t":"set","p":"lower","pt":"msg","to":"lower","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":3630,"wires":[["d8357b79cab8a74d"]]},{"id":"d8357b79cab8a74d","type":"switch","z":"7e987ddf260bdf0d","name":"which","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"upper","vt":"msg"},{"t":"lte","v":"lower","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":630,"y":3750,"wires":[["8e7ae331061e2715"],["a331757d56ce0dc6"],["2dea12e2e6a3994f"]]},{"id":"8e7ae331061e2715","type":"debug","z":"7e987ddf260bdf0d","name":"> Upper","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":3700,"wires":[]},{"id":"a331757d56ce0dc6","type":"debug","z":"7e987ddf260bdf0d","name":"<= Lower","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":3750,"wires":[]},{"id":"2dea12e2e6a3994f","type":"debug","z":"7e987ddf260bdf0d","name":"Ignore","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":3800,"wires":[]}]

Once you have see how it works, you can then try changing the upper and lower values and see how that works with the 1 - 15 input value range.

Below is my existing flow. I think your flow will do everything I'm looking for - will have to figure out if there's something in the edge detection node that handles things differently and that I haven't considered.

Thanks for the help!

Edge-Trigger: node-red-contrib-edge-trigger (node) - Node-RED

[{"id":"b90b68822ca6deeb","type":"tab","label":"Flow 5","disabled":false,"info":"","env":[]},{"id":"99ac0c1ad1d80b0b","type":"inject","z":"b90b68822ca6deeb","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"13","payloadType":"num","x":90,"y":400,"wires":[["e28979d55bd87f0f","a0e10db6ac1b7377"]]},{"id":"3218d0948c4aa270","type":"inject","z":"b90b68822ca6deeb","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"18","payloadType":"num","x":90,"y":340,"wires":[["e28979d55bd87f0f","a0e10db6ac1b7377"]]},{"id":"1f8f954ebbed2f29","type":"inject","z":"b90b68822ca6deeb","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"9","payloadType":"num","x":90,"y":460,"wires":[["e28979d55bd87f0f","a0e10db6ac1b7377"]]},{"id":"9319e6e4fde2a6a2","type":"debug","z":"b90b68822ca6deeb","name":"Up","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":710,"y":280,"wires":[]},{"id":"e28979d55bd87f0f","type":"falling-edge","z":"b90b68822ca6deeb","name":"Down","threshold":"10","x":290,"y":460,"wires":[["95ed8da3e6ceefc4"]]},{"id":"d929d2acd703537d","type":"mqtt out","z":"b90b68822ca6deeb","name":"","topic":"Tank1-Valve/relay/0/set","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"8aa408ca715b9482","x":770,"y":520,"wires":[]},{"id":"a0e10db6ac1b7377","type":"rising-edge","z":"b90b68822ca6deeb","name":"Up","threshold":"17","x":330,"y":300,"wires":[["9bf00f62785d78c6"]]},{"id":"80d9234dfecd6c07","type":"mqtt out","z":"b90b68822ca6deeb","name":"","topic":"Tank1-Valve/relay/0/set","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"8aa408ca715b9482","x":770,"y":220,"wires":[]},{"id":"f52e718f76717016","type":"debug","z":"b90b68822ca6deeb","name":"Down","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":710,"y":460,"wires":[]},{"id":"9bf00f62785d78c6","type":"change","z":"b90b68822ca6deeb","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":260,"wires":[["80d9234dfecd6c07","9319e6e4fde2a6a2"]]},{"id":"95ed8da3e6ceefc4","type":"change","z":"b90b68822ca6deeb","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":500,"wires":[["d929d2acd703537d","f52e718f76717016"]]},{"id":"8aa408ca715b9482","type":"mqtt-broker","name":"MQTTBroker","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

The only short fall of my code is there is no hysteresis in the values.