Cannot connect to AUBO using node red

I'm currently connecting from node-red to Aubobot through tcp in node red but node red shows disconnected, I am able to ping AUBO IP from my computer and have checked the lan cable connection. I have also tried restarting node-red but the problem still persists. Would appreciate any help!

can you show us your "Format data" node?

is it this?


from you error messages, it says that the node is called "Format data". If you click on it, it should highlight the node, where it comes from.


Can you check with a debug node, what you receive in msg.payload.data.processDataIn[4] and show your result?

I'm very new with node-red I try to see what it receives from it but cant see anything that receives from the msg.payload.data.processDataIn[4]. Before I did this flow there is no problem with the format data.

Do you have more than one node named ‘Format data’?
Please export your flow and attach it to a reply. Seeing that you are new to Node-Red I have some suggestions for you:
—-canned replies —-

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

I have a lot of node named 'Format data'.

[{"id":"21ffecd6.574a94","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"if (msg.statusCode === 200) {\n    var field1 = msg.payload.data.processDataIn[3];\n    msg.payload = (field1);\n    \n    // Convert Boolean to int\n    if (msg.payload === false) {\n        msg.payload = 0;  // device is not on\n        } else {\n            msg.payload = 1;  // device is on\n            }\n\n    //Write NODE status\n    node.status({ fill: \"green\", shape: \"ring\", text: \"Device state: \" + msg.payload + \"\"});\n    \n} else {\n    node.status({ fill: \"red\", shape: \"ring\", text: \"Error: \" + \"receiving data\" + \"\"});\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":660,"wires":[["fc860248.1eaee","7ea70d76.d236f4"]]},{"id":"3c3f3a37.9ca4a6","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"if (msg.statusCode === 200) {\n\n    var proFieOcc = msg.payload.data.processDataIn[5];\n    msg.payload = Number(proFieOcc);\n    \n    //Write NODE status\n    node.status({ fill: \"green\", shape: \"ring\", text: \"Sensor value: \" + msg.payload + \"\"});\n    \n} else {\n    node.status({ fill: \"red\", shape: \"ring\", text: \"Error: \" + \"receiving data\" + \"\"});\n}\n\n//Return message\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":580,"wires":[["a8c473c5.a5cbc","f14f9e08.dbcec"]]},{"id":"a8c473c5.a5cbc","type":"ui_gauge","z":"e5821b49.e7c068","name":"","group":"49b1ef3.441551","order":8,"width":12,"height":3,"gtype":"wave","title":"Sensor Value","label":"","format":"{{value}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1070,"y":540,"wires":[]},{"id":"855dd3a.556753","type":"ui_text","z":"e5821b49.e7c068","group":"49b1ef3.441551","order":7,"width":12,"height":1,"name":"","label":"Switching Output ","format":"{{msg.payload}}","layout":"row-spread","x":1090,"y":460,"wires":[]},{"id":"b63e7e2d.a8c2b","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"if (msg.statusCode === 200) {\n    var field1 = msg.payload.data.processDataIn[1];\n    msg.payload = (field1);\n   \n    // Convert Boolean to int\n    if (msg.payload === false) {\n        msg.payload = 0;  // device is not on\n        } else {\n            msg.payload = 1;  // device is on\n            }\n            \n    //Write NODE status\n    node.status({ fill: \"green\", shape: \"ring\", text: \"Object present: \" + msg.payload + \"\"});\n    \n} else {\n    node.status({ fill: \"red\", shape: \"ring\", text: \"Error: \" + \"receiving data\" + \"\"});\n}\n\n//Return message\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":500,"wires":[["855dd3a.556753","6b929c31.e458a4"]]},{"id":"fc860248.1eaee","type":"ui_text","z":"e5821b49.e7c068","group":"49b1ef3.441551","order":13,"width":12,"height":1,"name":"","label":"Device State","format":"{{msg.payload}}","layout":"row-spread","x":1070,"y":620,"wires":[]},{"id":"f14f9e08.dbcec","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n    'id':'200',\n    'version':'1.0',\n    'params':[\n        {\n            \"deviceKey\": \"U6i3S20vbQ\",\n            \"measurepoints\": {\n                \"sws_sig200_port0_sensorValue\": msg.payload\n            },\n            \"time\": new Date()*1e6/1000000\n        }\n    ],\n    'method':'integration.measurement.post'\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":580,"wires":[["8195a0c.9967c6"]]},{"id":"8195a0c.9967c6","type":"json","z":"e5821b49.e7c068","name":"","property":"payload","action":"","pretty":false,"x":1290,"y":680,"wires":[["9a17b6c6.e80518","e922e6f6.6f6348"]]},{"id":"9a17b6c6.e80518","type":"mqtt out","z":"e5821b49.e7c068","name":"SWS DECADA","topic":"/sys/nJy7b4CO/integration/measurepoint/post","qos":"","retain":"","broker":"3c8d6f1f.2c0bb","x":1480,"y":680,"wires":[]},{"id":"e922e6f6.6f6348","type":"debug","z":"e5821b49.e7c068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1470,"y":600,"wires":[]},{"id":"6b929c31.e458a4","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n    'id':'200',\n    'version':'1.0',\n    'params':[\n        {\n            \"deviceKey\": \"U6i3S20vbQ\",\n            \"measurepoints\": {\n                \"sws_sig200_port0_switchingOutput\": msg.payload\n            },\n            \"time\": new Date()*1e6/1000000\n        }\n    ],\n    'method':'integration.measurement.post'\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":500,"wires":[["8195a0c.9967c6"]]},{"id":"7ea70d76.d236f4","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n    'id':'200',\n    'version':'1.0',\n    'params':[\n        {\n            \"deviceKey\": \"U6i3S20vbQ\",\n            \"measurepoints\": {\n                \"sws_sig200_port0_deviceState\": msg.payload\n            },\n            \"time\": new Date()*1e6/1000000\n        }\n    ],\n    'method':'integration.measurement.post'\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":660,"wires":[["8195a0c.9967c6"]]},{"id":"cb8d3f5d.965f5","type":"mqtt out","z":"e5821b49.e7c068","name":"SWS DECADA","topic":"/sys/nJy7b4CO/integration/attribute/post","qos":"","retain":"","broker":"3c8d6f1f.2c0bb","x":1480,"y":180,"wires":[]},{"id":"677224b2.7f872c","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"if (msg.statusCode === 200) {\n\n    var field1 = msg.payload.data.processDataIn[4];\n    msg.payload = (field1);\n    \n    // Convert Boolean to int\n    if (msg.payload === false) {\n        msg.payload = 0;  // device is not on\n        } else {\n            msg.payload = 1;  // device is on\n            }\n\n    //Write NODE status\n    node.status({ fill: \"green\", shape: \"ring\", text: \"Device state: \" + msg.payload + \"\"});\n    \n} else {\n    node.status({ fill: \"red\", shape: \"ring\", text: \"Error: \" + \"receiving data\" + \"\"});\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":900,"wires":[["fc3fe157.723c9","3df3894d.3e43b6"]]},{"id":"608351a5.7ca98","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"if (msg.statusCode === 200) {\n    var proFieOcc = msg.payload.data.processDataIn[5];\n    msg.payload = Number(proFieOcc);\n    \n    //Write NODE status\n    node.status({ fill: \"green\", shape: \"ring\", text: \"Sensor value: \" + proFieOcc + \"\"});\n    \n} else {\n    node.status({ fill: \"red\", shape: \"ring\", text: \"Error: \" + \"receiving data\" + \"\"});\n}\n\n//Return message\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":820,"wires":[["9899d3c6.be5b","bbbf3633.cfe3b8"]]},{"id":"9899d3c6.be5b","type":"ui_gauge","z":"e5821b49.e7c068","name":"","group":"49b1ef3.441551","order":10,"width":12,"height":3,"gtype":"wave","title":"Sensor Value","label":"","format":"{{value}}","min":0,"max":"1","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1070,"y":780,"wires":[]},{"id":"dbcb7a47.c73c98","type":"ui_text","z":"e5821b49.e7c068","group":"49b1ef3.441551","order":5,"width":12,"height":1,"name":"","label":"Switching Output ","format":"{{msg.payload}}","layout":"row-spread","x":1090,"y":700,"wires":[]},{"id":"11085ea5.a4a511","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"if (msg.statusCode === 200) {\n    var field1 = msg.payload.data.processDataIn[1];\n    msg.payload = (field1);\n   \n    // Convert Boolean to int\n    if (msg.payload === false) {\n        msg.payload = 0;  // device is not on\n        } else {\n            msg.payload = 1;  // device is on\n            }\n            \n    //Write NODE status\n    node.status({ fill: \"green\", shape: \"ring\", text: \"Object present: \" + msg.payload + \"\"});\n    \n} else {\n    node.status({ fill: \"red\", shape: \"ring\", text: \"Error: \" + \"receiving data\" + \"\"});\n}\n\n//Return message\nreturn msg;","outputs":1,"noerr":0,"x":854,"y":741,"wires":[["dbcb7a47.c73c98","389f3108.bfdb7e"]]},{"id":"fc3fe157.723c9","type":"ui_text","z":"e5821b49.e7c068","group":"49b1ef3.441551","order":15,"width":12,"height":1,"name":"","label":"Device State","format":"{{msg.payload}}","layout":"row-spread","x":1070,"y":860,"wires":[]},{"id":"bbbf3633.cfe3b8","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n    'id':'200',\n    'version':'1.0',\n    'params':[\n        {\n            \"deviceKey\": \"U6i3S20vbQ\",\n            \"measurepoints\": {\n                \"sws_sig200_port1_sensorValue\": msg.payload\n            },\n            \"time\": new Date()*1e6/1000000\n        }\n    ],\n    'method':'integration.measurement.post'\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":820,"wires":[["8195a0c.9967c6"]]},{"id":"389f3108.bfdb7e","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n    'id':'200',\n    'version':'1.0',\n    'params':[\n        {\n            \"deviceKey\": \"U6i3S20vbQ\",\n            \"measurepoints\": {\n                \"sws_sig200_port1_switchingOutput\": msg.payload\n            },\n            \"time\": new Date()*1e6/1000000\n        }\n    ],\n    'method':'integration.measurement.post'\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1084,"y":741,"wires":[["8195a0c.9967c6"]]},{"id":"3df3894d.3e43b6","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n    'id':'200',\n    'version':'1.0',\n    'params':[\n        {\n            \"deviceKey\": \"U6i3S20vbQ\",\n            //\"deviceSecret\":\"HSCwrVw4NQIFg7fEne65\",\n            \"measurepoints\": {\n                \"sws_sig200_port1_deviceState\": msg.payload\n            },\n            \"time\": new Date()*1e6/1000000\n        }\n    ],\n    'method':'integration.measurement.post'\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":900,"wires":[["8195a0c.9967c6"]]},{"id":"3b450849.9ff2e8","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"var V_ProductName = msg.payload.data.V_ProductName;\n      msg.payload = V_ProductName;\n\n//Write NODE status\nnode.status({ fill: \"green\", shape: \"ring\", text: \"V_ProductName: \" + V_ProductName + \"\"});\n\n//Return message\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":140,"wires":[["f975d118.c2e08","da208e05.16ffa"]]},{"id":"52499b37.349614","type":"function","z":"e5821b49.e7c068","name":"Format data","func":"var V_ProductName = msg.payload.data.V_ProductName;\n      msg.payload = V_ProductName;\n\n//Write NODE status\nnode.status({ fill: \"green\", shape: \"ring\", text: \"V_ProductName: \" + V_ProductName + \"\"});\n\n//Return message\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":220,"wires":[["39519a04.6185a6","197f41fd.4f216e"]]},{"id":"f975d118.c2e08","type":"ui_text","z":"e5821b49.e7c068","group":"49b1ef3.441551","order":4,"width":12,"height":1,"name":"","label":"Sensor Product Name","format":"{{msg.payload}}","layout":"col-center","x":1100,"y":100,"wires":[]},{"id":"da208e05.16ffa","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n\"id\": \"200\",\n\"version\": \"1.1\",\n\"params\":[\n       {\n           \"deviceKey\": \"U6i3S20vbQ\",\n           \"attributes\": {\n                          \"sws_sig200_port0_V_ProductName\": msg.payload\n                         }\n        }\n    ],\n  \"method\": \"integration.attribute.post\"\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":140,"wires":[["b26f7e2e.1eeed"]]},{"id":"39519a04.6185a6","type":"ui_text","z":"e5821b49.e7c068","group":"49b1ef3.441551","order":2,"width":12,"height":1,"name":"","label":"Sensor Product Name","format":"{{msg.payload}}","layout":"col-center","x":1100,"y":180,"wires":[]},{"id":"197f41fd.4f216e","type":"function","z":"e5821b49.e7c068","name":"Format JSON","func":"var data = \n{\n\"id\": \"200\",\n\"version\": \"1.1\",\n\"params\":[\n       {\n           \"deviceKey\": \"U6i3S20vbQ\",\n           \"attributes\": {\n                          \"sws_sig200_port1_V_ProductName\": msg.payload\n                         }\n        }\n    ],\n  \"method\": \"integration.attribute.post\"\n};\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":220,"wires":[["b26f7e2e.1eeed"]]},{"id":"b26f7e2e.1eeed","type":"json","z":"e5821b49.e7c068","name":"","property":"payload","action":"","pretty":false,"x":1290,"y":180,"wires":[["6f3925b2.b5365c"]]},{"id":"6f3925b2.b5365c","type":"debug","z":"e5821b49.e7c068","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":120,"wires":[]},{"id":"67401a4b.ff2df4","type":"debug","z":"e5821b49.e7c068","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1100,"y":1000,"wires":[]},{"id":"49b1ef3.441551","type":"ui_group","z":"","name":"Sensors","tab":"eb9f0f6a.50d39","order":2,"disp":true,"width":25,"collapse":false},{"id":"3c8d6f1f.2c0bb","type":"mqtt-broker","z":"","name":"SWS DECADA (Message integration)","broker":"tcp://mqtt.decada.gov.sg:11883","port":"11883","tls":"c0da20e.c5282e","clientid":"nJy7b4CO|securemode=4,signmethod=sha1,timestamp=1628834345035|","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"eb9f0f6a.50d39","type":"ui_tab","z":"","name":"SWS","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"c0da20e.c5282e","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"fcd24dabf9-certificate.pem.crt","keyname":"fcd24dabf9-private.pem.key","caname":"x509_root.crt","servername":"","verifyservercert":true}]

^ this is the flow JSON of the format data. thank you for the recommendation, I will watch it now.

I suggest you add a unique number as part of the name so you can determine the exact node with the issue