# Cannot connect to AUBO using node red

**URL:** <https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [28 April 2022 02:38 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904 "2022-04-28T02:38:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![CY02](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@CY02](https://discourse.nodered.org/u/CY02)\
**Post date:** [28 April 2022 02:38 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/1 "2022-04-28T02:38:27Z")

</div>

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!

 ![Screenshot (12)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/96245a5e3c57fb86b77697c4aa89608263276329.png)

---

<div class="post-metadata">

**Author:** ![nico25](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nico25](https://discourse.nodered.org/u/nico25)\
**Post date:** [28 April 2022 06:48 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/2 "2022-04-28T06:48:21Z")

</div>

can you show us your "Format data" node?

---

<div class="post-metadata">

**Author:** ![CY02](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@CY02](https://discourse.nodered.org/u/CY02)\
**Post date:** [28 April 2022 06:54 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/3 "2022-04-28T06:54:15Z")

</div>

is it this?

 ![Screenshot (13)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d7549c1f741c566bc6c76f7444bf0fcfe175311.png)  
 ![Screenshot (14)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/658f4b17b3dda482278bc3fd6770e2f621705561.png)

---

<div class="post-metadata">

**Author:** ![nico25](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nico25](https://discourse.nodered.org/u/nico25)\
**Post date:** [28 April 2022 06:56 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/4 "2022-04-28T06:56:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![CY02](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@CY02](https://discourse.nodered.org/u/CY02)\
**Post date:** [28 April 2022 06:59 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/5 "2022-04-28T06:59:59Z")

</div>

![Screenshot (15)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/895cbfee915cb407e230dc850678a4311bcf4b64.png)  
 ![Screenshot (16)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e339970910f77c930eef045e7cf1983708ad69f0.png)

---

<div class="post-metadata">

**Author:** ![nico25](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nico25](https://discourse.nodered.org/u/nico25)\
**Post date:** [28 April 2022 07:35 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/6 "2022-04-28T07:35:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CY02](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@CY02](https://discourse.nodered.org/u/CY02)\
**Post date:** [29 April 2022 01:53 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/7 "2022-04-29T01:53:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [29 April 2022 08:24 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/8 "2022-04-29T08:24:45Z")

</div>

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 `````)

````auto
``` 
   code goes here 
```

````

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

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). 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.

---

<div class="post-metadata">

**Author:** ![CY02](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@CY02](https://discourse.nodered.org/u/CY02)\
**Post date:** [4 May 2022 01:31 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/9 "2022-05-04T01:31:31Z")

</div>

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

```auto
[{"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.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [4 May 2022 01:43 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/10 "2022-05-04T01:43:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 July 2022 01:43 UTC](https://discourse.nodered.org/t/cannot-connect-to-aubo-using-node-red/61904/11 "2022-07-03T01:43:55Z")

</div>

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