How to transfer data in Node-RED to Influxdb on another computer

I tried to use Node-Red in the gateway to transfer data from PLC to InfluxDB in another device in the LAN via OPCUA protocol. The gateway and this device can ping through. I have also set the correct Orgnization and Bucket and Token in Node InfluxDB, but the following error occurs in the InfluxDB node during operation:
“RequestTimedOutError: Request timed out”
Did I miss something? Could you give me some advice?

@Bulang_Mao

Can you paste your flow from NodeRED? Also, which Influx node are you using?

[
{
“id”: “08aa6954aca1ec14”,
“type”: “tab”,
“label”: “Flow 1”,
“disabled”: false,
“info”: “”,
“env”:
},
{
“id”: “c3c90ca655020311”,
“type”: “inject”,
“z”: “08aa6954aca1ec14”,
“name”: “GreiferI1”,
“props”: [
{
“p”: “topic”,
“vt”: “str”
}
],
“repeat”: “15”,
“crontab”: “”,
“once”: false,
“onceDelay”: 0.1,
“topic”: “ns=4;s=|var|WAGO 750-8100 PFC100 CS 2ETH ECO.Vakuum_Sauggreifer.IoConfig_Globals_Mapping.I1”,
“x”: 300,
“y”: 280,
“wires”: [
[
“d6757fd4aaff9386”
]
]
},
{
“id”: “d6757fd4aaff9386”,
“type”: “OpcUa-Client”,
“z”: “08aa6954aca1ec14”,
“endpoint”: “dcd299aae3ba0c5e”,
“action”: “subscribe”,
“deadbandtype”: “a”,
“deadbandvalue”: 1,
“time”: “5”,
“timeUnit”: “s”,
“certificate”: “n”,
“localfile”: “”,
“localkeyfile”: “”,
“securitymode”: “None”,
“securitypolicy”: “None”,
“folderName4PKI”: “”,
“name”: “”,
“x”: 480,
“y”: 280,
“wires”: [
[
“11b63bf81599c13c”,
“a4bed6e8762e85e5”
]
]
},
{
“id”: “11b63bf81599c13c”,
“type”: “debug”,
“z”: “08aa6954aca1ec14”,
“name”: “debug 3”,
“active”: true,
“tosidebar”: true,
“console”: false,
“tostatus”: false,
“complete”: “false”,
“statusVal”: “”,
“statusType”: “auto”,
“x”: 660,
“y”: 280,
“wires”:
},
{
“id”: “a4bed6e8762e85e5”,
“type”: “influxdb out”,
“z”: “08aa6954aca1ec14”,
“influxdb”: “f5d1092888f85947”,
“name”: “I1”,
“measurement”: “I1”,
“precision”: “”,
“retentionPolicy”: “”,
“database”: “database”,
“precisionV18FluxV20”: “ms”,
“retentionPolicyV18Flux”: “”,
“org”: “InfoLabor”,
“bucket”: “Greifer_Bool”,
“x”: 650,
“y”: 340,
“wires”:
},
{
“id”: “dcd299aae3ba0c5e”,
“type”: “OpcUa-Endpoint”,
“endpoint”: “opc.tcp://192.168.0.82:4840”,
“secpol”: “None”,
“secmode”: “None”,
“none”: false,
“login”: false,
“usercert”: false,
“usercertificate”: “”,
“userprivatekey”: “”
},
{
“id”: “f5d1092888f85947”,
“type”: “influxdb”,
“hostname”: “127.0.0.1”,
“port”: “8086”,
“protocol”: “http”,
“database”: “database”,
“name”: “General”,
“usetls”: false,
“tls”: “”,
“influxdbVersion”: “2.0”,
“url”: “http://192.168.0.24:8086”,
“rejectUnauthorized”: true
}
]
hi grant1, thanks for the reply. Here is the flow from Node-Red.
I use the influxdb-output node from node-red-contrib-influxdb.

Please paste your flow following the correct protocol.

To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly.

The easiest way to do that is to click the ‘Preformatted Text’ button in the toolbar:

image

Then paste in your code or flow json.

You should end up with three back-tick characters - ````` - on their own line before and after the code.

On standard US English keyboards, this is on the same key as the ~ character.

image

Using the backticks will ensure the forum does not reformat the code.

[{"id":"bbef23cc.4e7f18","type":"inject"}]

You can see the quotes remain untouched.

I get errors using what you pasted.

thanks for the advice. I re-posted it.

[
    {
        "id": "08aa6954aca1ec14",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "c3c90ca655020311",
        "type": "inject",
        "z": "08aa6954aca1ec14",
        "name": "GreiferI1",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "15",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "ns=4;s=|var|WAGO 750-8100 PFC100 CS 2ETH ECO.Vakuum_Sauggreifer.IoConfig_Globals_Mapping.I1",
        "x": 300,
        "y": 280,
        "wires": [
            [
                "d6757fd4aaff9386"
            ]
        ]
    },
    {
        "id": "d6757fd4aaff9386",
        "type": "OpcUa-Client",
        "z": "08aa6954aca1ec14",
        "endpoint": "dcd299aae3ba0c5e",
        "action": "subscribe",
        "deadbandtype": "a",
        "deadbandvalue": 1,
        "time": "5",
        "timeUnit": "s",
        "certificate": "n",
        "localfile": "",
        "localkeyfile": "",
        "securitymode": "None",
        "securitypolicy": "None",
        "folderName4PKI": "",
        "name": "",
        "x": 480,
        "y": 280,
        "wires": [
            [
                "11b63bf81599c13c",
                "a4bed6e8762e85e5"
            ]
        ]
    },
    {
        "id": "11b63bf81599c13c",
        "type": "debug",
        "z": "08aa6954aca1ec14",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 280,
        "wires": []
    },
    {
        "id": "a4bed6e8762e85e5",
        "type": "influxdb out",
        "z": "08aa6954aca1ec14",
        "influxdb": "f5d1092888f85947",
        "name": "I1",
        "measurement": "I1",
        "precision": "",
        "retentionPolicy": "",
        "database": "database",
        "precisionV18FluxV20": "ms",
        "retentionPolicyV18Flux": "",
        "org": "InfoLabor",
        "bucket": "Greifer_Bool",
        "x": 650,
        "y": 340,
        "wires": []
    },
    {
        "id": "dcd299aae3ba0c5e",
        "type": "OpcUa-Endpoint",
        "endpoint": "opc.tcp://192.168.0.82:4840",
        "secpol": "None",
        "secmode": "None",
        "none": false,
        "login": false,
        "usercert": false,
        "usercertificate": "",
        "userprivatekey": ""
    },
    {
        "id": "f5d1092888f85947",
        "type": "influxdb",
        "hostname": "127.0.0.1",
        "port": "8086",
        "protocol": "http",
        "database": "database",
        "name": "General",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "2.0",
        "url": "http://192.168.0.24:8086",
        "rejectUnauthorized": true
    }
]

When you inject, what appears in the debug pane? It would seem you need a function node before the Influx node to format the data.

image
It would send the data from PLC like the picture show.

OK, so you need a function node to take the contents you are seeing in the Debug node and format it to the format that InfluxDB wants. For example, in the function below, I am sending the field temperature, along with the tag “actual”, another field called millivolts, and again the tag “actual”.

msg.payload = [
    [{
        temperature: msg.payload.temperature
    },
    {
        MeasType: "actual"
    }],
    [{
        millivolts: msg.payload.millivolts
    },
    {
        MeasType: "actual"
    }]
];
return msg;

The timestamp will be automatically populated when the data enters InfluxDB.

It needs to look like this in the Debug node:
image

Can you list the fields and tags (if any) that you wish to send into InfluxDB?

Hi grant1, thanks for the Info and I learned something new from it. But when I tried your method, it seems that the timeout bug is not caused by this. Because I also have a flow with data type boolean. I got the same error when I tested it separately.
image
I also tried changing the boolean to an int type, and the error was not removed.

And I just downloaded Influxdb in Gateway. By changing the login URL and Token I was able to successfully post the data to Influxdb on Gateway. This proves that the reason why Influxdb on my PC is not receiving data is probably a setup issue.

Oh man…I found that the public setting of Influxdb is turned off by default in the firewall. When I turned it on the information interaction was achieved