( NOOB ) Numeric input as value for if else function

Hello Community,

I previsouly want to excuse my self if this question was already answerd or discussed. But I searched since two days and try to solved it myself but with now succed.

Im new into this topic of programming or node-red, so maybe I also searched for the wrong keywords.

My aim is to switch some sockets based on temperature and humidity.

As Hardware i use:

Raspberry Pi 4
1x BME280
2x DHT11
1x 8-Relay Modul

I already have succed to control a gpio-port via humidity-data based on the DHT11 and to display these data on gauges and charts.

I use a simple if-else function:

if (msg.payload >= "50")
{
    msg.payload = "1";
}
else{
    msg.payload = "0";
}
return msg;

I now want to change the fix value "50" with an numeric-input, so i could adjust the "setpoint" using the UI.

My problem is that the numeric-input gives out the "value" into the msg.payload. I would like to change the msg.payload to something else like msg.setpoint1 and then use this to compare with the sensor-data.

I have tried serval methods but since I am brandnew to programming, I think I made basic false.

Could you please help me with this topic ?

Thanks in advance for your help!

BR,

Julian

Here my complete Flow up to now:

[{"id":"e7cc1df7.3d5998","type":"tab","label":"Flow 1","disabled":true,"info":""},{"id":"824d4163.2e34e8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"b4973237.46ab6","type":"subflow","name":"Process Simulation","info":"","in":[{"x":37,"y":103,"wires":[{"id":"ec719d4d.0d54f8"}]}],"out":[{"x":728.5,"y":294,"wires":[{"id":"ae1a6e5.d4c0d9","port":0}]}]},{"id":"f8eee6e9.39f318","type":"subflow","name":"Process Simulation (2)","info":"","in":[{"x":37,"y":103,"wires":[{"id":"a417f220.2ac8"}]}],"out":[{"x":728.5,"y":294,"wires":[{"id":"4ec6d42d.4bf864","port":0}]}]},{"id":"baf56f66.7c227","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#333333","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"392761e1.58b1ce","type":"ui_group","name":"Innen","tab":"d08f9018.10d48","order":1,"disp":true,"width":"6","collapse":true},{"id":"d08f9018.10d48","type":"ui_tab","name":"Gauges","icon":"dashboard","disabled":false,"hidden":false},{"id":"311c7f64.99049","type":"ui_group","name":"Außen","tab":"d08f9018.10d48","order":3,"disp":true,"width":"6","collapse":true},{"id":"4a18f57e.e46b2c","type":"ui_tab","name":"Charts","icon":"dashboard","disabled":false,"hidden":false},{"id":"e73cf005.e6077","type":"ui_group","name":"Außen","tab":"4a18f57e.e46b2c","order":3,"disp":true,"width":"6","collapse":true},{"id":"95396172.f59558","type":"ui_group","name":"Innen","tab":"4a18f57e.e46b2c","order":1,"disp":true,"width":"6","collapse":false},{"id":"a85a00c1.6c4c08","type":"ui_group","name":"Reference","tab":"d08f9018.10d48","order":2,"disp":true,"width":"6","collapse":false},{"id":"8b28c9b3.4993b8","type":"ui_group","name":"Charts_Reference","tab":"4a18f57e.e46b2c","order":2,"disp":true,"width":"6","collapse":false},{"id":"c45a83a3.d00908","type":"ui_group","name":"PID","tab":"80cd4062.93a5","order":1,"disp":true,"width":"6"},{"id":"80cd4062.93a5","type":"ui_tab","name":"Home","icon":"dashboard"},{"id":"e96f47c3.29a858","type":"inject","z":"824d4163.2e34e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"45","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":100,"wires":[["94f4c676.d62ef"]]},{"id":"9ec4518a.d0912","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":60,"wires":[]},{"id":"94f4c676.d62ef","type":"rpi-dht22","z":"824d4163.2e34e8","name":"Sensor_1_Innen_steuert","topic":"rpi-dht22","dht":"11","pintype":"0","pin":"27","x":320,"y":100,"wires":[["9ec4518a.d0912","f48cec98.3ca598","5559668c.cbb53"]]},{"id":"b77dd665.430c48","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":40,"wires":[]},{"id":"5bd19384.3df4b4","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":220,"wires":[]},{"id":"f48cec98.3ca598","type":"function","z":"824d4163.2e34e8","name":"Temp","func":"msg.payload = msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":100,"wires":[["b77dd665.430c48","b773b909.0f2a7","6c444829.d2a41","f35331ac.5e5368"]]},{"id":"5559668c.cbb53","type":"function","z":"824d4163.2e34e8","name":"RLF","func":"msg.payload  = (msg.humidity) ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":220,"wires":[["5bd19384.3df4b4","aab909a5.cc0438","13f07c15.f32844","9d62339f.84dbc","faa4c467.90b118","a6c3bdcb.f41438","f1d229f9.031c9"]]},{"id":"b773b909.0f2a7","type":"ui_gauge","z":"824d4163.2e34e8","name":"","group":"392761e1.58b1ce","order":0,"width":0,"height":0,"gtype":"gage","title":"Temperatur","label":"° Celius","format":"{{value}}","min":0,"max":"40","colors":["#00c7ec","#44e604","#ff4700"],"seg1":"17","seg2":"25","x":800,"y":100,"wires":[]},{"id":"aab909a5.cc0438","type":"ui_gauge","z":"824d4163.2e34e8","name":"","group":"392761e1.58b1ce","order":1,"width":0,"height":0,"gtype":"gage","title":"Luftfeuchte","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#f5ec22","#24e600","#ca3838"],"seg1":"40","seg2":"79","x":800,"y":280,"wires":[]},{"id":"6c444829.d2a41","type":"ui_chart","z":"824d4163.2e34e8","name":"","group":"95396172.f59558","order":3,"width":0,"height":0,"label":"Temp","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":780,"y":140,"wires":[[]]},{"id":"13f07c15.f32844","type":"ui_chart","z":"824d4163.2e34e8","name":"","group":"95396172.f59558","order":1,"width":0,"height":0,"label":"RLF","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":780,"y":320,"wires":[[]]},{"id":"9d62339f.84dbc","type":"ui_text","z":"824d4163.2e34e8","group":"95396172.f59558","order":2,"width":0,"height":0,"name":"Innen RLF aktuell","label":"aktuell","format":"{{msg.payload}} %","layout":"col-center","x":820,"y":360,"wires":[]},{"id":"c69abdd5.013aa","type":"inject","z":"824d4163.2e34e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"45","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":540,"wires":[["bf83e87a.23523"]]},{"id":"ad9f6bda.cab1f8","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":420,"y":500,"wires":[]},{"id":"bf83e87a.23523","type":"rpi-dht22","z":"824d4163.2e34e8","name":"Sensor_2_außen","topic":"rpi-dht22","dht":"11","pintype":"0","pin":"17","x":280,"y":540,"wires":[["ad9f6bda.cab1f8","b5a9208c.f3dd98","776e49a5.830908"]]},{"id":"a4612506.5f19e8","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":480,"wires":[]},{"id":"de171541.c4a94","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":660,"wires":[]},{"id":"b5a9208c.f3dd98","type":"function","z":"824d4163.2e34e8","name":"Temp","func":"msg.payload = msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":540,"wires":[["a4612506.5f19e8","8ac18ab6.bbb658","df82528b.f785e8","81bf58c9.646a8"]]},{"id":"776e49a5.830908","type":"function","z":"824d4163.2e34e8","name":"RLF","func":"msg.payload = msg.humidity ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":660,"wires":[["de171541.c4a94","450d24c6.387424","7b18b18e.1087c","57bf6536.035a4c"]]},{"id":"8ac18ab6.bbb658","type":"ui_gauge","z":"824d4163.2e34e8","name":"","group":"311c7f64.99049","order":0,"width":0,"height":0,"gtype":"gage","title":"Temperatur","label":"° Celius","format":"{{value}}","min":0,"max":"40","colors":["#0bdfec","#44e604","#ff4500"],"seg1":"17","seg2":"25","x":780,"y":540,"wires":[]},{"id":"450d24c6.387424","type":"ui_gauge","z":"824d4163.2e34e8","name":"RLF_außen","group":"311c7f64.99049","order":1,"width":0,"height":0,"gtype":"gage","title":"Luftfeuchte","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#aab500","#24e600","#ca3838"],"seg1":"40","seg2":"79","x":780,"y":720,"wires":[]},{"id":"df82528b.f785e8","type":"ui_chart","z":"824d4163.2e34e8","name":"","group":"e73cf005.e6077","order":3,"width":0,"height":0,"label":"Temp","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":760,"y":580,"wires":[[]]},{"id":"7b18b18e.1087c","type":"ui_chart","z":"824d4163.2e34e8","name":"RLF_außen","group":"e73cf005.e6077","order":1,"width":0,"height":0,"label":"RLF","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":780,"y":760,"wires":[[]]},{"id":"57bf6536.035a4c","type":"ui_text","z":"824d4163.2e34e8","group":"e73cf005.e6077","order":2,"width":0,"height":0,"name":"außen akutell RLF","label":"aktuell","format":"{{msg.payload}} %","layout":"col-center","x":800,"y":800,"wires":[]},{"id":"5bbd2e86.060f1","type":"inject","z":"824d4163.2e34e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"15","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":980,"wires":[["9c660f79.730f88"]]},{"id":"2882083b.450aa","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":900,"wires":[]},{"id":"9c660f79.730f88","type":"Bme280","z":"824d4163.2e34e8","name":"Sensor_3_Innen_REF","bus":"1","address":"0x76","topic":"bme280","extra":false,"x":340,"y":980,"wires":[["2882083b.450aa","3a266373.356414","7ddd29a4.10dff"]]},{"id":"9323c584.91295","type":"ui_gauge","z":"824d4163.2e34e8","name":"Reference_Temp","group":"a85a00c1.6c4c08","order":2,"width":0,"height":0,"gtype":"gage","title":"Temp_Reference","label":"° Celsius","format":"{{value}}","min":0,"max":"40","colors":["#00b5b3","#50e604","#ca6700"],"seg1":"17","seg2":"29","x":735,"y":1020,"wires":[],"l":false},{"id":"3a266373.356414","type":"change","z":"824d4163.2e34e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature_C","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":980,"wires":[["9323c584.91295","7452c68e.cb4f98","dcae4842.423b58","9ee32c35.87064"]]},{"id":"7452c68e.cb4f98","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":940,"wires":[]},{"id":"4b13935b.faa2fc","type":"ui_gauge","z":"824d4163.2e34e8","name":"","group":"a85a00c1.6c4c08","order":1,"width":0,"height":0,"gtype":"gage","title":"RLF_Reference","label":"%","format":"{{msg.payload.humidity}}","min":0,"max":"100","colors":["#eeeb00","#12e600","#ca3838"],"seg1":"40","seg2":"75","x":820,"y":1300,"wires":[]},{"id":"7ddd29a4.10dff","type":"change","z":"824d4163.2e34e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humidity","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":1200,"wires":[["4deec21e.db5464","59a83670.3325e8"]]},{"id":"849623c6.0deed","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.humidity","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":1220,"wires":[]},{"id":"4deec21e.db5464","type":"function","z":"824d4163.2e34e8","name":"","func":"var gerundet = Math.round( msg.payload * 10 ) / 10;\nmsg.payload = {\"humidity\": gerundet};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":1260,"wires":[["849623c6.0deed","4b13935b.faa2fc","ba564a70.797748"]]},{"id":"dcae4842.423b58","type":"ui_chart","z":"824d4163.2e34e8","name":"","group":"8b28c9b3.4993b8","order":4,"width":0,"height":0,"label":"Temp_Reference","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":810,"y":1060,"wires":[[]]},{"id":"59a83670.3325e8","type":"ui_chart","z":"824d4163.2e34e8","name":"","group":"8b28c9b3.4993b8","order":1,"width":0,"height":0,"label":"RLF_Reference","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":790,"y":1360,"wires":[[]]},{"id":"81bf58c9.646a8","type":"ui_text","z":"824d4163.2e34e8","group":"e73cf005.e6077","order":2,"width":0,"height":0,"name":"außen aktuell Temp","label":"aktuell","format":"{{msg.payload}} °","layout":"col-center","x":790,"y":620,"wires":[]},{"id":"f35331ac.5e5368","type":"ui_text","z":"824d4163.2e34e8","group":"95396172.f59558","order":2,"width":0,"height":0,"name":"Innen Temp aktuell","label":"aktuell","format":"{{msg.payload}} °","layout":"col-center","x":830,"y":180,"wires":[]},{"id":"9ee32c35.87064","type":"ui_text","z":"824d4163.2e34e8","group":"8b28c9b3.4993b8","order":3,"width":0,"height":0,"name":"","label":"aktuell","format":"{{msg.payload}} °","layout":"col-center","x":770,"y":1120,"wires":[]},{"id":"ba564a70.797748","type":"ui_text","z":"824d4163.2e34e8","group":"8b28c9b3.4993b8","order":2,"width":0,"height":0,"name":"","label":"aktuell","format":"{{msg.payload.humidity}} %","layout":"col-center","x":770,"y":1420,"wires":[]},{"id":"faa4c467.90b118","type":"function","z":"824d4163.2e34e8","name":" Relais RLF","func":"if(msg.payload >= \"65\")\n{\n    msg.payload = \"1\";\n}\nelse{\n    msg.payload = \"0\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":400,"wires":[["c3cf8c70.387f2","346ba57d.209c42"]],"icon":"node-red-dashboard/ui_switch.png"},{"id":"346ba57d.209c42","type":"debug","z":"824d4163.2e34e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1210,"y":280,"wires":[]},{"id":"7fe4b5c3.32e58c","type":"function","z":"b4973237.46ab6","name":"30 sec RC + 20","func":"// Applies a simple RC low pass filter to incoming payload values\nvar tc = 30*1000;       // time constant in milliseconds\n\nvar lastValue = context.get('lastValue');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n    // first time through\n    newValue = currentValue;\n} else {\n    var dt = now - lastTime;\n    var newValue;\n    \n    if (dt > 0) {\n        var dtotc = dt / tc;\n        newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n    } else {\n        // no time has elapsed leave output the same as last time\n        newValue = lastValue;\n    }\n}\ncontext.set('lastValue', newValue);\ncontext.set('lastTime', now);\n\nmsg.payload = newValue + 20;\nreturn msg;","outputs":1,"noerr":0,"x":626.5,"y":207,"wires":[["ae1a6e5.d4c0d9"]]},{"id":"1bacd004.9753c","type":"inject","z":"b4973237.46ab6","name":"Inject -0.2 at start","repeat":"","crontab":"","once":true,"topic":"","payload":"-0.2","payloadType":"num","x":134.5,"y":30,"wires":[["ec719d4d.0d54f8"]]},{"id":"999a52c2.f465f","type":"function","z":"b4973237.46ab6","name":"10 sec RC","func":"// Applies a simple RC low pass filter to incoming payload values\nvar tc = 10*1000;       // time constant in milliseconds\n\nvar lastValue = context.get('lastValue');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n    // first time through\n    newValue = currentValue;\n} else {\n    var dt = now - lastTime;\n    var newValue;\n    \n    if (dt > 0) {\n        var dtotc = dt / tc;\n        newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n    } else {\n        // no time has elapsed leave output the same as last time\n        newValue = lastValue;\n    }\n}\ncontext.set('lastValue', newValue);\ncontext.set('lastTime', now);\n\nmsg.payload = newValue;\nreturn msg;","outputs":1,"noerr":0,"x":451,"y":207,"wires":[["7fe4b5c3.32e58c"]]},{"id":"ec719d4d.0d54f8","type":"delay","z":"b4973237.46ab6","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":268,"y":104,"wires":[["ede39236.1961f8"]]},{"id":"a823c9cf.2a6178","type":"function","z":"b4973237.46ab6","name":"2 msg transport delay","func":"// stores messages in a fifo until the specified number have been received, \n// then releases them as new messages are received.\n// during the filling phase the earliest message is passed on each time \n// a message is received, but it is also left in the fifo\nvar fifoMaxLength = 2;\nvar fifo = context.get('fifo') || [];\n// push the new message onto the top of the array, messages are shifted down and\n// drop off the front\nvar length = fifo.push(msg);  // returns new length\nif (length > fifoMaxLength) {\n    newMsg = fifo.shift();\n} else {\n    // not full yet, make a copy of the msg and pass it on\n    var newMsg = JSON.parse(JSON.stringify(fifo[0]));\n}\ncontext.set('fifo', fifo);\nreturn newMsg;","outputs":1,"noerr":0,"x":258,"y":208,"wires":[["999a52c2.f465f"]]},{"id":"ae1a6e5.d4c0d9","type":"function","z":"b4973237.46ab6","name":"Clear all except payload","func":"msg2 = {payload: msg.payload};\nreturn msg2;","outputs":1,"noerr":0,"x":545,"y":293,"wires":[[]]},{"id":"ede39236.1961f8","type":"range","z":"b4973237.46ab6","minin":"0","maxin":"1","minout":"0","maxout":"100","action":"scale","round":false,"name":"","x":87,"y":208,"wires":[["a823c9cf.2a6178"]]},{"id":"dc40c377.ae2e5","type":"function","z":"f8eee6e9.39f318","name":"30 sec RC + 20","func":"// Applies a simple RC low pass filter to incoming payload values\nvar tc = 30*1000;       // time constant in milliseconds\n\nvar lastValue = context.get('lastValue');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n    // first time through\n    newValue = currentValue;\n} else {\n    var dt = now - lastTime;\n    var newValue;\n    \n    if (dt > 0) {\n        var dtotc = dt / tc;\n        newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n    } else {\n        // no time has elapsed leave output the same as last time\n        newValue = lastValue;\n    }\n}\ncontext.set('lastValue', newValue);\ncontext.set('lastTime', now);\n\nmsg.payload = newValue + 20;\nreturn msg;","outputs":1,"noerr":0,"x":626.5,"y":207,"wires":[["4ec6d42d.4bf864"]]},{"id":"ca417482.b24af","type":"inject","z":"f8eee6e9.39f318","name":"Inject -0.2 at start","repeat":"","crontab":"","once":true,"topic":"","payload":"-0.2","payloadType":"num","x":134.5,"y":30,"wires":[["a417f220.2ac8"]]},{"id":"b08f75dd.fce01","type":"function","z":"f8eee6e9.39f318","name":"10 sec RC","func":"// Applies a simple RC low pass filter to incoming payload values\nvar tc = 10*1000;       // time constant in milliseconds\n\nvar lastValue = context.get('lastValue');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n    // first time through\n    newValue = currentValue;\n} else {\n    var dt = now - lastTime;\n    var newValue;\n    \n    if (dt > 0) {\n        var dtotc = dt / tc;\n        newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n    } else {\n        // no time has elapsed leave output the same as last time\n        newValue = lastValue;\n    }\n}\ncontext.set('lastValue', newValue);\ncontext.set('lastTime', now);\n\nmsg.payload = newValue;\nreturn msg;","outputs":1,"noerr":0,"x":451,"y":207,"wires":[["dc40c377.ae2e5"]]},{"id":"a417f220.2ac8","type":"delay","z":"f8eee6e9.39f318","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":268,"y":104,"wires":[["eee5a03f.1d07b8"]]},{"id":"2c954b5.d7d69b4","type":"function","z":"f8eee6e9.39f318","name":"2 msg transport delay","func":"// stores messages in a fifo until the specified number have been received, \n// then releases them as new messages are received.\n// during the filling phase the earliest message is passed on each time \n// a message is received, but it is also left in the fifo\nvar fifoMaxLength = 2;\nvar fifo = context.get('fifo') || [];\n// push the new message onto the top of the array, messages are shifted down and\n// drop off the front\nvar length = fifo.push(msg);  // returns new length\nif (length > fifoMaxLength) {\n    newMsg = fifo.shift();\n} else {\n    // not full yet, make a copy of the msg and pass it on\n    var newMsg = JSON.parse(JSON.stringify(fifo[0]));\n}\ncontext.set('fifo', fifo);\nreturn newMsg;","outputs":1,"noerr":0,"x":258,"y":208,"wires":[["b08f75dd.fce01"]]},{"id":"4ec6d42d.4bf864","type":"function","z":"f8eee6e9.39f318","name":"Clear all except payload","func":"msg2 = {payload: msg.payload};\nreturn msg2;","outputs":1,"noerr":0,"x":545,"y":293,"wires":[[]]},{"id":"eee5a03f.1d07b8","type":"range","z":"f8eee6e9.39f318","minin":"0","maxin":"1","minout":"0","maxout":"100","action":"scale","round":false,"name":"","x":87,"y":208,"wires":[["2c954b5.d7d69b4"]]},{"id":"e09c16e3.833de","type":"rpi-gpio out","z":"e7cc1df7.3d5998","name":"GELB","pin":"37","set":"","level":"0","freq":"","out":"out","x":480,"y":160,"wires":[]},{"id":"b582e173.5499b","type":"rpi-gpio out","z":"e7cc1df7.3d5998","name":"Grün","pin":"35","set":"","level":"0","freq":"","out":"out","x":470,"y":100,"wires":[]},{"id":"2e74c7a0.972d78","type":"rpi-gpio out","z":"e7cc1df7.3d5998","name":"ROT","pin":"33","set":"","level":"0","freq":"","out":"out","x":470,"y":40,"wires":[]},{"id":"836751a9.a81138","type":"ui_switch","z":"e7cc1df7.3d5998","name":"","label":"switch","tooltip":"","group":"392761e1.58b1ce","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":270,"y":160,"wires":[["e09c16e3.833de"]]},{"id":"17ba64a0.2a128b","type":"ui_switch","z":"e7cc1df7.3d5998","name":"","label":"switch","tooltip":"","group":"392761e1.58b1ce","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":270,"y":40,"wires":[["2e74c7a0.972d78"]]},{"id":"7c13c7ac.80aff","type":"ui_switch","z":"e7cc1df7.3d5998","name":"","label":"switch","tooltip":"","group":"392761e1.58b1ce","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":273,"y":111,"wires":[["b582e173.5499b"]]},{"id":"1c8d0122.c27baf","type":"rpi-gpio out","z":"824d4163.2e34e8","name":"GELB","pin":"37","set":"","level":"0","freq":"","out":"out","x":1270,"y":500,"wires":[]},{"id":"50d20807.02c208","type":"rpi-gpio out","z":"824d4163.2e34e8","name":"Grün","pin":"35","set":"","level":"0","freq":"","out":"out","x":1260,"y":440,"wires":[]},{"id":"c3cf8c70.387f2","type":"rpi-gpio out","z":"824d4163.2e34e8","name":"ROT","pin":"33","set":"","level":"0","freq":"","out":"out","x":1250,"y":360,"wires":[]},{"id":"a6c3bdcb.f41438","type":"function","z":"824d4163.2e34e8","name":" Relais RLF","func":"if(msg.payload >= \"50\")\n{\n    msg.payload = \"1\";\n}\nelse{\n    msg.payload = \"0\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":440,"wires":[["50d20807.02c208","346ba57d.209c42"]],"icon":"node-red-dashboard/ui_switch.png"},{"id":"f1d229f9.031c9","type":"function","z":"824d4163.2e34e8","name":" Relais RLF","func":"if(msg.payload < \"50\")\n{\n    msg.payload = \"1\";\n}\nelse{\n    msg.payload = \"0\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1010,"y":480,"wires":[["1c8d0122.c27baf","346ba57d.209c42"]],"icon":"node-red-dashboard/ui_switch.png"}]

Hi and welcome.

You can use a change node after the numeric input, set to move msg,payload to msg.setpoint.

when posting code it is good practice to post between backticks, i.e.
```
code
```
This makes the thread less messy and easier for someone to copy and past your code. Your posted flow has syntax errors due to not posting in code tags, if you want someone to look at it please repost.

Thanks a lot E1cid for your reply !

I've already have tried this. It works if I use it as a "seperat" flow.
But if I try to integrade it into my "complete" flow, it seems like the value "msg.setpoint1" couldn't get trough it all.
I always get a "undefined". As I said I do something basic wrong I guess.

I create a numeric input -> change node ( msg.payload set to msg.setpoint1 )

Now I change:

if(msg.payload >= msg.setpoint1)
{
    msg.payload = "1";
}
else{
    msg.payload = "0";
}
return msg;

than I connect like this numeric -> change -> function -> gpio

[{"id":"e7cc1df7.3d5998","type":"tab","label":"Flow 1","disabled":true,"info":""},{"id":"cf558310.25ed4","type":"inject","z":"e7cc1df7.3d5998","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"45","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":140,"wires":[["83e25880.fe0df8"]]},{"id":"dd5a9660.f0f2c","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":420,"y":100,"wires":[]},{"id":"83e25880.fe0df8","type":"rpi-dht22","z":"e7cc1df7.3d5998","name":"Sensor_1_Innen_steuert","topic":"rpi-dht22","dht":"11","pintype":"0","pin":"27","x":300,"y":140,"wires":[["dd5a9660.f0f2c","76abd39d.c24304","9002205a.703ea"]]},{"id":"7441567f.930e88","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":80,"wires":[]},{"id":"b2385c89.ab3fa","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":260,"wires":[]},{"id":"76abd39d.c24304","type":"function","z":"e7cc1df7.3d5998","name":"Temp","func":"msg.payload = msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":140,"wires":[["7441567f.930e88","2a4a8115.bf66a6","ecf8ddd9.d71658","fb39700.555881"]]},{"id":"9002205a.703ea","type":"function","z":"e7cc1df7.3d5998","name":"RLF","func":"msg.payload  = (msg.humidity) ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":260,"wires":[["b2385c89.ab3fa","dc0aaf63.a0cc3","40c584d6.2f2394","e807a1dc.91822","da81a8a5.68853"]]},{"id":"2a4a8115.bf66a6","type":"ui_gauge","z":"e7cc1df7.3d5998","name":"","group":"392761e1.58b1ce","order":0,"width":0,"height":0,"gtype":"gage","title":"Temperatur","label":"° Celius","format":"{{value}}","min":0,"max":"40","colors":["#00c7ec","#44e604","#ff4700"],"seg1":"17","seg2":"25","x":780,"y":140,"wires":[]},{"id":"dc0aaf63.a0cc3","type":"ui_gauge","z":"e7cc1df7.3d5998","name":"","group":"392761e1.58b1ce","order":1,"width":0,"height":0,"gtype":"gage","title":"Luftfeuchte","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#f5ec22","#24e600","#ca3838"],"seg1":"40","seg2":"79","x":780,"y":320,"wires":[]},{"id":"ecf8ddd9.d71658","type":"ui_chart","z":"e7cc1df7.3d5998","name":"","group":"95396172.f59558","order":3,"width":0,"height":0,"label":"Temp","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":760,"y":180,"wires":[[]]},{"id":"40c584d6.2f2394","type":"ui_chart","z":"e7cc1df7.3d5998","name":"","group":"95396172.f59558","order":1,"width":0,"height":0,"label":"RLF","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":760,"y":360,"wires":[[]]},{"id":"e807a1dc.91822","type":"ui_text","z":"e7cc1df7.3d5998","group":"95396172.f59558","order":2,"width":0,"height":0,"name":"Innen RLF aktuell","label":"aktuell","format":"{{msg.payload}} %","layout":"col-center","x":800,"y":400,"wires":[]},{"id":"fb39700.555881","type":"ui_text","z":"e7cc1df7.3d5998","group":"95396172.f59558","order":2,"width":0,"height":0,"name":"Innen Temp aktuell","label":"aktuell","format":"{{msg.payload}} °","layout":"col-center","x":810,"y":220,"wires":[]},{"id":"da81a8a5.68853","type":"function","z":"e7cc1df7.3d5998","name":" Relais RLF","func":"if(msg.payload >= msg.setpoint1)\n{\n    msg.payload = \"1\";\n}\nelse{\n    msg.payload = \"0\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":990,"y":440,"wires":[["f3f7b670.4914a","4d0924cf.c0d53c"]],"icon":"node-red-dashboard/ui_switch.png"},{"id":"4d0924cf.c0d53c","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1190,"y":320,"wires":[]},{"id":"f3f7b670.4914a","type":"rpi-gpio out","z":"e7cc1df7.3d5998","name":"ROT","pin":"33","set":"","level":"0","freq":"","out":"out","x":1230,"y":400,"wires":[]},{"id":"4514ea4f.df10bc","type":"ui_numeric","z":"e7cc1df7.3d5998","name":"","label":"numeric","tooltip":"","group":"392761e1.58b1ce","order":4,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"100","step":"5","x":170,"y":380,"wires":[["5035df21.3fbf18"]]},{"id":"5035df21.3fbf18","type":"change","z":"e7cc1df7.3d5998","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"setpoint1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":540,"wires":[["da81a8a5.68853"]]},{"id":"392761e1.58b1ce","type":"ui_group","name":"Innen","tab":"d08f9018.10d48","order":1,"disp":true,"width":"6","collapse":true},{"id":"95396172.f59558","type":"ui_group","name":"Innen","tab":"4a18f57e.e46b2c","order":1,"disp":true,"width":"6","collapse":false},{"id":"d08f9018.10d48","type":"ui_tab","name":"Gauges","icon":"dashboard","disabled":false,"hidden":false},{"id":"4a18f57e.e46b2c","type":"ui_tab","name":"Charts","icon":"dashboard","disabled":false,"hidden":false}]

You have this the wrong way around (many people trip up on this)

image

It reads set msg.payload to the value of msg.setpoint1

you need it to read set msg.setpoint1 to the value of msg.payload

Ok now i can see your flow, your msg payload and setpoint are not in the same message

so i suggest store your set point to flow context storage in the change node. Then in your function access it with
let setpoint1 = flow.get("setpoint1");
then remove the link from change node to function , as setpoint1 will be stored so no need for link.
eg.

[{"id":"363fcc54.cf7524","type":"change","z":"f39fb4b0.07c328","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"setpoint1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":540,"wires":[[]]},{"id":"c5313c1c.a0843","type":"ui_numeric","z":"f39fb4b0.07c328","name":"","label":"numeric","tooltip":"","group":"86e8e8b4.07b458","order":4,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"100","step":"5","x":170,"y":380,"wires":[["363fcc54.cf7524"]]},{"id":"86e8e8b4.07b458","type":"ui_group","name":"Innen","tab":"470994c.e5f66ec","order":1,"disp":true,"width":"6","collapse":true},{"id":"470994c.e5f66ec","type":"ui_tab","name":"Gauges","icon":"dashboard","disabled":false,"hidden":false}]

you can also add a defualt if setpoint has not be stored yet
let setpoint1 = flow.get("setpoint1") || 20;

Thanks again for the fast replay ! :star_struck:

Ok I've now change the change-node to set msg.setpoint1 to msg.payload.

Than I add to the function-node:

let setpoint1 = flow.get("setpoint1") || 20;

if(msg.payload >= "setpoint1")
{
    msg.payload = "1";
}
else{
    msg.payload = "0";
}
return msg;

If I now change the value to it still outputs '0' as msg.paylod. So it not respond on my changes, how could I check if the changes really effect into the function-node ?

show your change node please

"Festlegen" means "set" :sweat_smile:

you need to move it to flow as below.

Still no effect on the output of the function node :frowning:

[{"id":"e7cc1df7.3d5998","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"cf558310.25ed4","type":"inject","z":"e7cc1df7.3d5998","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"45","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":140,"wires":[["83e25880.fe0df8"]]},{"id":"dd5a9660.f0f2c","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":420,"y":100,"wires":[]},{"id":"83e25880.fe0df8","type":"rpi-dht22","z":"e7cc1df7.3d5998","name":"Sensor_1_Innen_steuert","topic":"rpi-dht22","dht":"11","pintype":"0","pin":"27","x":300,"y":140,"wires":[["dd5a9660.f0f2c","76abd39d.c24304","9002205a.703ea"]]},{"id":"7441567f.930e88","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":80,"wires":[]},{"id":"b2385c89.ab3fa","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":260,"wires":[]},{"id":"76abd39d.c24304","type":"function","z":"e7cc1df7.3d5998","name":"Temp","func":"msg.payload = msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":140,"wires":[["7441567f.930e88","2a4a8115.bf66a6","ecf8ddd9.d71658","fb39700.555881"]]},{"id":"9002205a.703ea","type":"function","z":"e7cc1df7.3d5998","name":"RLF","func":"msg.payload  = (msg.humidity) ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":260,"wires":[["b2385c89.ab3fa","dc0aaf63.a0cc3","40c584d6.2f2394","e807a1dc.91822","da81a8a5.68853"]]},{"id":"2a4a8115.bf66a6","type":"ui_gauge","z":"e7cc1df7.3d5998","name":"","group":"392761e1.58b1ce","order":0,"width":0,"height":0,"gtype":"gage","title":"Temperatur","label":"° Celius","format":"{{value}}","min":0,"max":"40","colors":["#00c7ec","#44e604","#ff4700"],"seg1":"17","seg2":"25","x":780,"y":140,"wires":[]},{"id":"dc0aaf63.a0cc3","type":"ui_gauge","z":"e7cc1df7.3d5998","name":"","group":"392761e1.58b1ce","order":1,"width":0,"height":0,"gtype":"gage","title":"Luftfeuchte","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#f5ec22","#24e600","#ca3838"],"seg1":"40","seg2":"79","x":780,"y":320,"wires":[]},{"id":"ecf8ddd9.d71658","type":"ui_chart","z":"e7cc1df7.3d5998","name":"","group":"95396172.f59558","order":3,"width":0,"height":0,"label":"Temp","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":760,"y":180,"wires":[[]]},{"id":"40c584d6.2f2394","type":"ui_chart","z":"e7cc1df7.3d5998","name":"","group":"95396172.f59558","order":1,"width":0,"height":0,"label":"RLF","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":760,"y":360,"wires":[[]]},{"id":"e807a1dc.91822","type":"ui_text","z":"e7cc1df7.3d5998","group":"95396172.f59558","order":2,"width":0,"height":0,"name":"Innen RLF aktuell","label":"aktuell","format":"{{msg.payload}} %","layout":"col-center","x":800,"y":400,"wires":[]},{"id":"fb39700.555881","type":"ui_text","z":"e7cc1df7.3d5998","group":"95396172.f59558","order":2,"width":0,"height":0,"name":"Innen Temp aktuell","label":"aktuell","format":"{{msg.payload}} °","layout":"col-center","x":810,"y":220,"wires":[]},{"id":"da81a8a5.68853","type":"function","z":"e7cc1df7.3d5998","name":" Relais RLF","func":"let setpoint1 = flow.get(\"setpoint1\") || 50;\n\nif(msg.payload >= \"setpoint1\")\n{\n    msg.payload = \"1\";\n}\nelse{\n    msg.payload = \"0\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":990,"y":440,"wires":[["f3f7b670.4914a","4d0924cf.c0d53c"]],"icon":"node-red-dashboard/ui_switch.png"},{"id":"4d0924cf.c0d53c","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1190,"y":320,"wires":[]},{"id":"f3f7b670.4914a","type":"rpi-gpio out","z":"e7cc1df7.3d5998","name":"ROT","pin":"33","set":"","level":"0","freq":"","out":"out","x":1230,"y":400,"wires":[]},{"id":"4514ea4f.df10bc","type":"ui_numeric","z":"e7cc1df7.3d5998","name":"","label":"numeric","tooltip":"","group":"392761e1.58b1ce","order":4,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"100","step":"5","x":170,"y":380,"wires":[["5035df21.3fbf18"]]},{"id":"5035df21.3fbf18","type":"change","z":"e7cc1df7.3d5998","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"setpoint1","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":500,"wires":[["fc76f76.9dd9a88"]]},{"id":"fc76f76.9dd9a88","type":"debug","z":"e7cc1df7.3d5998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1080,"y":540,"wires":[]},{"id":"392761e1.58b1ce","type":"ui_group","name":"Innen","tab":"d08f9018.10d48","order":1,"disp":true,"width":"6","collapse":true},{"id":"95396172.f59558","type":"ui_group","name":"Innen","tab":"4a18f57e.e46b2c","order":1,"disp":true,"width":"6","collapse":false},{"id":"d08f9018.10d48","type":"ui_tab","name":"Gauges","icon":"dashboard","disabled":false,"hidden":false},{"id":"4a18f57e.e46b2c","type":"ui_tab","name":"Charts","icon":"dashboard","disabled":false,"hidden":false}]

What is the output to the debug from the function node. Best to set debug node to complete message object and post result

let setpoint1 = flow.get("setpoint1") || 20;

if(msg.payload >= setpoint1)
{
    msg.payload = "1";
}
else{
    msg.payload = "0";
}
return msg;

you have quotes around setpoint 1, remove them as above
"setpoint1" is a string
setpoint1 is a variable

I'm so sorry for your time :pensive: , now it works ! Thanks a lot !

As I said I'm totaly new into this, and sooo many thing you can trip on.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.