My Node-red doesn't work any more after some changes

#1

I changed something on my node-red and now I can’t get it working back again.
I can’t remember what I changed that I didn’t change back to initial !

[{"id":"48008912.e789","type":"inject","z":"aa8f5fa1.bc60d8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"x":729.5,"y":335,"wires":[["7e056a04.f774ec"]]},{"id":"fd6d7c69.c8ceb","type":"serial in","z":"aa8f5fa1.bc60d8","name":"","serial":"9939954d.414a","x":75,"y":134,"wires":[["2f334200.b7c346"]]},{"id":"2f334200.b7c346","type":"switch","z":"aa8f5fa1.bc60d8","name":"redirection payload ","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"<","vt":"str"},{"t":"eq","v":"t","vt":"str"},{"t":"eq","v":"a","vt":"str"}],"checkall":"false","outputs":3,"x":257.8333740234375,"y":135.3333740234375,"wires":[["dc7c5379.fe7c88"],[],[]]},{"id":"dc7c5379.fe7c88","type":"csv","z":"aa8f5fa1.bc60d8","name":"","sep":"\\t","hdrin":false,"hdrout":false,"multi":"one","ret":"\\n","temp":"none, now, timer, T_amb, Tc_K, Consigne, Feedback,  flag_capteur, Pyro, output_dac, adc1_V, Err","x":440.5,"y":120,"wires":[["aa0c7a5b.bca5e8","112c938e.70b904","68142d77.4df4dc","9c0ff4fd.4761b","8d7ff7c4.dd4ce","6d734602.137658","545f4a8d.7c424c","e378f0c7.44d79","51b7f3f8.e13e04","dc9aee39.041b88","639237e2.05fcb","7e62b326.54dbac","ca930176.718f98"]]},{"id":"aa0c7a5b.bca5e8","type":"debug","z":"aa8f5fa1.bc60d8","name":"","active":true,"console":"true","complete":"payload","x":325.5,"y":255,"wires":[]},{"id":"8d7ff7c4.dd4ce","type":"ui_gauge","z":"aa8f5fa1.bc60d8","name":"","group":"52880442.6f8dfc","order":2,"width":0,"height":0,"gtype":"gage","title":"Thermocouple","label":"°C","format":" {{msg.payload.Tc_K}} ","min":0,"max":"1200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":727,"y":122.83334350585938,"wires":[]},{"id":"112c938e.70b904","type":"ui_text","z":"aa8f5fa1.bc60d8","group":"1708d647.04db7a","order":3,"width":0,"height":0,"name":"","label":"Secondes écoulées","format":"{{msg.payload.now}}","layout":"row-left","x":610.333251953125,"y":40,"wires":[]},{"id":"68142d77.4df4dc","type":"ui_text","z":"aa8f5fa1.bc60d8","group":"1708d647.04db7a","order":5,"width":0,"height":0,"name":"","label":"Timer","format":"{{msg.payload.timer}}","layout":"row-left","x":641.333251953125,"y":75,"wires":[]},{"id":"9c0ff4fd.4761b","type":"ui_text","z":"aa8f5fa1.bc60d8","group":"1708d647.04db7a","order":6,"width":0,"height":0,"name":"Tamb","label":"T_amb","format":"{{msg.payload.T_amb}}","layout":"row-left","x":752.333251953125,"y":92,"wires":[]},{"id":"6d734602.137658","type":"ui_gauge","z":"aa8f5fa1.bc60d8","name":"","group":"12a6957e.88ac3b","order":1,"width":0,"height":0,"gtype":"gage","title":"Consigne","label":"°C","format":" {{msg.payload.Consigne}} ","min":0,"max":"1050","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":883.333251953125,"y":128.66665649414062,"wires":[]},{"id":"545f4a8d.7c424c","type":"ui_gauge","z":"aa8f5fa1.bc60d8","name":"","group":"a0898c66.f0283","order":2,"width":0,"height":0,"gtype":"gage","title":"Feedback","label":"°C","format":" {{msg.payload.Feedback}} ","min":0,"max":"1200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":755.333251953125,"y":157.66665649414062,"wires":[]},{"id":"e378f0c7.44d79","type":"ui_gauge","z":"aa8f5fa1.bc60d8","name":"","group":"d518e72d.e17d78","order":1,"width":0,"height":0,"gtype":"gage","title":"Pyromètre","label":"°C","format":" {{msg.payload.Pyro}} ","min":"250","max":"1200","colors":["#00acb5","#00b500","#ca3838"],"seg1":"1000","seg2":"1100","x":672.333251953125,"y":221.66665649414062,"wires":[]},{"id":"51b7f3f8.e13e04","type":"ui_gauge","z":"aa8f5fa1.bc60d8","name":"","group":"d183329a.5b0ba8","order":1,"width":0,"height":0,"gtype":"gage","title":"output_MCP4725_digit","label":"bit","format":" {{msg.payload.output_dac}} ","min":0,"max":"4095","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":874.333251953125,"y":235.66665649414062,"wires":[]},{"id":"327f75ce.6e0682","type":"ui_text","z":"aa8f5fa1.bc60d8","group":"1708d647.04db7a","order":4,"width":0,"height":0,"name":"","label":"Capteur en usage","format":"{{msg.payload.flag_capteur}}","layout":"row-left","x":872,"y":200.16671752929688,"wires":[]},{"id":"dc9aee39.041b88","type":"ui_gauge","z":"aa8f5fa1.bc60d8","name":"","group":"d183329a.5b0ba8","order":2,"width":0,"height":0,"gtype":"gage","title":"Recopie_dac_MCP","label":"V","format":" {{msg.payload.adc1_V}} ","min":0,"max":"5","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":880.2498779296875,"y":268.5833435058594,"wires":[]},{"id":"7e62b326.54dbac","type":"function","z":"aa8f5fa1.bc60d8","name":"Tc_K ON / Pyrometre ON","func":"if (msg.payload == 0){\n    msg.payload = \"Tc_K ON\";\n} else if(msg.payload == 1){\n    msg.payload = \"Pyrometre ON\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":642.7332763671875,"y":189.31668090820312,"wires":[["327f75ce.6e0682"]]},{"id":"7e056a04.f774ec","type":"ui_gauge","z":"aa8f5fa1.bc60d8","name":"","group":"1708d647.04db7a","order":7,"width":0,"height":0,"gtype":"gage","title":"Offset","label":"°C","format":"{{msg.payload}}","min":"-100","max":"100","colors":["#0073b5","#00b500","#ca3838"],"seg1":"-20","seg2":"20","x":850.7332763671875,"y":301.7833251953125,"wires":[]},{"id":"639237e2.05fcb","type":"ui_text","z":"aa8f5fa1.bc60d8","group":"1708d647.04db7a","order":0,"width":0,"height":0,"name":"","label":"Erreurs","format":" {{msg.payload.Err}} ","layout":"row-left","x":664.7332763671875,"y":261.2166748046875,"wires":[]},{"id":"ca930176.718f98","type":"function","z":"aa8f5fa1.bc60d8","name":"","func":"msg.payload = Math.round(msg.payload.Feedback - msg.payload.Consigne);\nreturn msg;","outputs":1,"noerr":0,"x":656.5,"y":299,"wires":[["7e056a04.f774ec"]]},{"id":"6d9ebc8a.b10334","type":"file","z":"aa8f5fa1.bc60d8","name":"","filename":"/home/harold/arduinoDataloggerToFile/arduino_dataloggerToFile","appendNewline":true,"createDir":false,"overwriteFile":"false","x":302.5,"y":322,"wires":[]},{"id":"dc5735e6.ebec78","type":"inject","z":"aa8f5fa1.bc60d8","name":"","topic":"","payload":"none, now, timer, T_amb, Tc_K, Consigne, Feedback,  flag_capteur, Pyro, output_dac, adc1_V, Err","payloadType":"str","repeat":"","crontab":"","once":true,"x":82.5,"y":388,"wires":[["6d9ebc8a.b10334"]]},{"id":"2277c72b.cd2d3","type":"ui_template","z":"aa8f5fa1.bc60d8","group":"c519da4c.f6bf9","name":"Logo / Clock","order":0,"width":0,"height":0,"format":"<script id=\"clockScript1\" type=\"text/javascript\">\n    var clockInterval;\n    $(function () {\n        if (clockInterval) return;\n\n        //add logo\n        var div1 = $('<div/>');\n        var logo = new Image();\n\n        logo.src = 'https://www.raiselife.eu/images/logo.png'\n        logo.height = 45;\n        div1[0].style.margin = '10px auto';\n\n        div1.append(logo);\n\n        //add clock\n        var div2 = $('<div/>');\n        var p = $('<p/>');\n\n        div2.append(p);\n        div2[0].style.margin = '5px';\n\n        function displayTime() {\n            p.text(new Date().toLocaleString());\n        }\n        \n        clockInterval = setInterval(displayTime, 1000);\n\n        //add to toolbar when it's available\n        var addToToolbarTimer;\n        \n        function addToToolbar() {\n            var toolbar = $('.md-toolbar-tools');\n            \n            if(!toolbar.length) return;\n            \n            toolbar.append(div1);\n            toolbar.append(div2);\n            clearInterval(addToToolbarTimer);\n        }\n        addToToolbarTimer = setInterval(addToToolbar, 100);\n    });\n</script>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"global","x":392,"y":28,"wires":[[]]},{"id":"42582393.3cd274","type":"ui_button","z":"aa8f5fa1.bc60d8","name":"","group":"1708d647.04db7a","order":1,"width":0,"height":0,"passthru":true,"label":"{{label}} ","color":"{{color}} ","bgcolor":"{{background}} ","icon":"","payload":"","payloadType":"str","topic":"","x":277,"y":511,"wires":[["af023bd6.a75168","19492725.dad619","9ef07639.7806c8"]]},{"id":"af023bd6.a75168","type":"delay","z":"aa8f5fa1.bc60d8","name":"","pauseType":"delay","timeout":"0.7","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":413,"y":511,"wires":[["3473c458.9cd3c4"]]},{"id":"3473c458.9cd3c4","type":"function","z":"aa8f5fa1.bc60d8","name":"Flip color RED/BLUE","func":"\nif (msg.background == \"GREEN\") {\n return null;\n}\nif (msg.background == \"RED\") {\n msg.background = \"BLUE\";\n msg.color = \"WHITE\";\n msg.label = \"RUNNING\";\n \n} else {\n msg.color = \"BLACK\";\n msg.background = \"RED\";\n msg.label = \"Tempering\";\n }\nreturn msg;","outputs":1,"noerr":0,"x":344,"y":554,"wires":[["42582393.3cd274"]]},{"id":"1e96a0d8.7882a7","type":"inject","z":"aa8f5fa1.bc60d8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"x":131,"y":460,"wires":[["1412846.dde0d7c"]]},{"id":"1412846.dde0d7c","type":"change","z":"aa8f5fa1.bc60d8","name":"","rules":[{"t":"set","p":"background","pt":"msg","to":"GREEN","tot":"str"},{"t":"set","p":"label","pt":"msg","to":"Tempering","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":283,"y":454,"wires":[["42582393.3cd274"]]},{"id":"555452dd.c3928c","type":"ui_button","z":"aa8f5fa1.bc60d8","name":"","group":"1708d647.04db7a","order":2,"width":0,"height":0,"passthru":true,"label":"{{label}} ","color":"{{color}} ","bgcolor":"{{background}} ","icon":"","payload":"","payloadType":"str","topic":"","x":285.91668701171875,"y":698.4166564941406,"wires":[["15b271cb.5dd326","d95f6dc1.6d0bf8","9ef07639.7806c8"]]},{"id":"15b271cb.5dd326","type":"delay","z":"aa8f5fa1.bc60d8","name":"","pauseType":"delay","timeout":"0.7","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":421.91668701171875,"y":698.4166564941406,"wires":[["36adca80.9c0f3e"]]},{"id":"36adca80.9c0f3e","type":"function","z":"aa8f5fa1.bc60d8","name":"Flip color RED/BLUE","func":"\nif (msg.background == \"GREEN\") {\n return null;\n}\nvar first = context.get('first')||true;\nif (msg.background == \"RED\") {\n msg.background = \"BLUE\";\n msg.color = \"WHITE\";\n if (!first){msg.payload = \"\"}\n} else {\n msg.color = \"BLACK\";\n msg.background = \"RED\";\n msg.label = \"Austeneziting RUNNING\";\n if (first){\n     msg.payload = \"a\";\n     context.set('first',false);\n     \n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":352.91668701171875,"y":741.4166564941406,"wires":[["555452dd.c3928c"]]},{"id":"cb507f25.6a75","type":"inject","z":"aa8f5fa1.bc60d8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"x":138.91668701171875,"y":646.4166259765625,"wires":[["d21a57e4.5892e8"]]},{"id":"d21a57e4.5892e8","type":"change","z":"aa8f5fa1.bc60d8","name":"","rules":[{"t":"set","p":"background","pt":"msg","to":"GREEN","tot":"str"},{"t":"set","p":"label","pt":"msg","to":"Austeniziting","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":291.91668701171875,"y":641.4166564941406,"wires":[["555452dd.c3928c"]]},{"id":"d95f6dc1.6d0bf8","type":"debug","z":"aa8f5fa1.bc60d8","name":"","active":true,"console":"false","complete":"payload","x":375.0833282470703,"y":853.0999603271484,"wires":[]},{"id":"19492725.dad619","type":"debug","z":"aa8f5fa1.bc60d8","name":"","active":true,"console":"false","complete":"payload","x":417,"y":595,"wires":[]},{"id":"9ef07639.7806c8","type":"serial out","z":"aa8f5fa1.bc60d8","name":"","serial":"9939954d.414a","x":840.0833129882812,"y":612.433349609375,"wires":[]},{"id":"9939954d.414a","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false},{"id":"52880442.6f8dfc","type":"ui_group","z":"","name":"Group 2","tab":"bdf79f7a.36f0a8","order":2,"disp":true,"width":"6","collapse":true},{"id":"1708d647.04db7a","type":"ui_group","z":"","name":"Group 1","tab":"bdf79f7a.36f0a8","order":1,"disp":true,"width":"6","collapse":false},{"id":"12a6957e.88ac3b","type":"ui_group","z":"","name":"Group 3","tab":"bdf79f7a.36f0a8","order":3,"disp":true,"width":"6","collapse":false},{"id":"a0898c66.f0283","type":"ui_group","z":"","name":"Group 4","tab":"bdf79f7a.36f0a8","order":4,"disp":true,"width":"6","collapse":false},{"id":"d518e72d.e17d78","type":"ui_group","name":"Group 5","tab":"bdf79f7a.36f0a8","order":5,"disp":true,"width":6},{"id":"d183329a.5b0ba8","type":"ui_group","z":"","name":"Debug","tab":"bdf79f7a.36f0a8","order":6,"disp":true,"width":"6","collapse":true},{"id":"c519da4c.f6bf9","type":"ui_group","z":"","name":"Default","tab":"c63bab3.e433ad8","order":1,"disp":false,"width":"24","collapse":false},{"id":"bdf79f7a.36f0a8","type":"ui_tab","z":"","name":"Curing","icon":"dashboard"},{"id":"c63bab3.e433ad8","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

I know the data expected from the arduino are coming.
I can see them in the arduino’s serial monitor or with screen

screen  /dev/ttyUSB0

But none of the data in node-red’s debug or on my dashboard ! :
:disappointed_relieved:

0 Likes

#2

only one thing can access a serial port

so if you are using screen, node-red cannot also see that port

0 Likes

#3

I’ve been trying screen or the arduino’s serial monitor for debug purpose only !
I’ve already been facing problems connecting 2 things at the same time on the serial !
I now know for sure, when node-red is running I must stop every else serial connection first.

But at the moment, that’s not the problem.
My dashboard doesn’t work, even with node-red using the serial. I know it connect to the serial, I can see it in the console when node-red is launched.

0 Likes

#4

Put debug nodes along the way to find out the earliest point in the flow where it isn’t working.
Too late now, I know, but once you have it working switch over to using the projects feature and then you can keep your flows under version control in git. When you do something and it stops working it is then trivial to revert the flow to the last working version.

0 Likes

#5

How to do that ?

I’ll try your advice tomorrow about debug node, I don’t have the arduino with me now.

0 Likes

#6

I have done your googling for you and found as the first hit
https://nodered.org/docs/user-guide/projects/

0 Likes