Compare slider with payload value

I am attempting to set 2 sliders, one maximum temperature, the other minimum temperature, compare the slider settings with the payload value (a numerical value which updates every 2 seconds) and output an approriate message on the dashboard (i.e. 'high limit exceeded')

I have looked at various examples and they mention using a settings node to store the slider value first and then a change node to do the compare but there appears to be no such thing as a settings node.

Is there a working sample somewhere to assit me, anything appreciated?

You can use a Join node to combine the messages from the sliders and the message with the current value and then you can compare them. See this example in the cookbook.

Thanks Colin, I tried the join and then a compare (with a switch node) but it doesn't seem to do anything. I suspect it has 'lost sight' of the payload value coming from the temperature sensor or there is something wrong with the logic / flow.

.

Start by feeding the output of the Join node into a debug and see what you get. Make sure you have different topics on the three incoming messages.
Did you look at the example I suggested to see how to configure the Join node?

Hello again, the output of the join (of the 2 sliders) is

"Message missing msg.parts property - cannot join in 'auto' mode"

I have no idea how you assign msg parts to sliders, they sem only to have topics to set.

Look again at the example I linked to, does it say to use Auto mode? Also you want to join all three, the two sliders and the message with the data.

[Edit] In case you didn't realise, if you click Show Flow you can copy the example from there and use the Import feature in node red to import it so you can see exactly what it does. You can then test the example flow using the inject nodes.

Thanks again,

I beieve the example works because the 3 inject nodes each has a topic wheras the numerical value going to the gauge does not and therefore cant be joined. I'm not sure if join is the right way to go to compare the value going to the gauge with the slider settings.

I was looking at this example https://ncd.io/node-red-enterprise-thermocouple/ earlier but it seems to use nodes which dont exist anymore (i.e. Settings).

you can add a topic to the value going to the gauge... it won't care.
What is in your function node ?

Add into the function node something like
msg.topic = "temperature"

Thanks again but I have no idea now whether I sstill need join and then switch or just swttch.

And sadly the sliders only output when they are being moved, there is nothing to store their settings persistently, so I cant compare their values when they are stationary.

This seems to be getting worse / a lot more complicated.

You need both. The join will hold the slider values as long as “and every subsequent message” is set

Thanks dceejay, join set exactly as you describe but nothing coming out of join or the following switch

Show us how you have configured the sliders

See below, changing the output from continuously to only on release or unticking msg arriving on input makes no difference. At a guess it seems that the sliders are never read unless changed.

Yes you have to set them to something.
You can se an inject Node set to inject at start to preset them if you want

Yes, but then there is only ever 3 messge parts (for the join) when the sensor provides a value and both sliders are also changed, at all other times there is no output from the sliders. Can't use injects because the sliders are meant to be temperature thresholds (set by the end customer usually once only).

There is no mechanism to query the settings of the sliders, even the status node doesn't work.

I will have to use a numeric input field or something, very sad.

No. Once the max and min are set then the join will send ALL 3 parts onwards every time a new value appears. (assuming you set the join correctly as shown)

Unfortunately that doesn't work, the join only outputs something if there is incoming sensor data at the same time you change the min and max sliders, otherwise there is only ever 1 part (the sensor data) and not 3 (the sliders are no longer moving)

Please share your flow then. It should work if set correctly.

The 'and every subsequent message' part is not working

[{"id":"b92d5f4f.74d5f8","type":"tcp in","z":"ee1ca0a4.c32d68","name":"","server":"client","host":"192.168.150.210","port":"2001","datamode":"stream","datatype":"utf8","newline":"\\r\\n","topic":"","base64":false,"x":190,"y":60,"wires":[["d47375c5.d618c8"]]},{"id":"1ef3f8ef.124ed7","type":"debug","z":"ee1ca0a4.c32d68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":440,"wires":[]},{"id":"d47375c5.d618c8","type":"function","z":"ee1ca0a4.c32d68","name":"Parse Sensor Value","func":"let newStr = msg.payload.slice(6, 10);\nmsg.payload = newStr;\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":140,"wires":[["57b767f5.6de168"]]},{"id":"3b93987e.f49358","type":"function","z":"ee1ca0a4.c32d68","name":"Convert to Temperature","func":"let newStr = (10.888 - Math.sqrt(Math.pow(-10.888, 2) +4*0.0035*(1777.3-msg.payload)))/(2*-0.00347) + 30;\nnewStr = Math.round(newStr * 10) / 10.0;\nmsg.payload = newStr;\nmsg.topic = \"temperature\";\nreturn [msg,msg];","outputs":2,"noerr":0,"x":350,"y":380,"wires":[["eb5ded22.04ee1"],["618b6457.f9d91c"]]},{"id":"57b767f5.6de168","type":"function","z":"ee1ca0a4.c32d68","name":"Conert to Decimal","func":"msg.payload = msg.payload.split(' ').map(function(hex){ return parseInt(hex, 16); });\nreturn msg;","outputs":1,"noerr":0,"x":230,"y":200,"wires":[["522575a3.ef6fe4"]]},{"id":"522575a3.ef6fe4","type":"function","z":"ee1ca0a4.c32d68","name":"Multiply by Step","func":"msg.payload = msg.payload*0.0001875 \nreturn msg;","outputs":1,"noerr":0,"x":260,"y":260,"wires":[["bda62893.6f1748"]]},{"id":"bda62893.6f1748","type":"function","z":"ee1ca0a4.c32d68","name":"Convert to millivolts","func":"msg.payload = msg.payload*1000\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":320,"wires":[["3b93987e.f49358"]]},{"id":"618b6457.f9d91c","type":"ui_gauge","z":"ee1ca0a4.c32d68","name":"","group":"8269e083.d7124","order":0,"width":0,"height":0,"gtype":"gage","title":"Temperature","label":"Degrees C","format":"{{value}}","min":"-50","max":"150","colors":["#00b500","#e6e600","#ca3838"],"seg1":"15","seg2":"25","x":350,"y":440,"wires":[]},{"id":"3373da84.6b950e","type":"ui_slider","z":"ee1ca0a4.c32d68","name":"Max Temp","label":"Max {{value}}°","tooltip":"","group":"8269e083.d7124","order":1,"width":"0","height":"0","passthru":true,"outs":"all","topic":"max_temp","min":"-50","max":"150","step":"1","x":300,"y":500,"wires":[["eb5ded22.04ee1"]]},{"id":"a9f31d2.c790d6","type":"ui_slider","z":"ee1ca0a4.c32d68","name":"Min Temp","label":"Min {{value}}°","tooltip":"","group":"8269e083.d7124","order":2,"width":0,"height":0,"passthru":true,"outs":"all","topic":"min_temp","min":"-50","max":"150","step":"1","x":300,"y":540,"wires":[["eb5ded22.04ee1"]]},{"id":"9f2efcdf.2738d","type":"ui_toast","z":"ee1ca0a4.c32d68","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"Temp too high","x":660,"y":560,"wires":[]},{"id":"f5311026.9381c","type":"ui_toast","z":"ee1ca0a4.c32d68","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"Temp too low","x":650,"y":620,"wires":[]},{"id":"816943c.faf59c","type":"switch","z":"ee1ca0a4.c32d68","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"min_temp","vt":"msg"},{"t":"gte","v":"max_temp","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":580,"wires":[["9f2efcdf.2738d"],["f5311026.9381c"]]},{"id":"eb5ded22.04ee1","type":"join","z":"ee1ca0a4.c32d68","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":480,"y":520,"wires":[["1ef3f8ef.124ed7"]]},{"id":"8269e083.d7124","type":"ui_group","z":"","name":"Lab 2","tab":"b9cb9efc.ec06d","disp":true,"width":"6","collapse":false},{"id":"b9cb9efc.ec06d","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]