Siemens 1200 plc to node red (TCP)

I am trying to communicate with a Siemens 1212 PLC using the open TCP blocks. On the node red side I have a TCP in (Port 2000) tied to a debug node. Additionally I have an inject tied to the TCP out node on port 2001.
On the PLC side I have it set to "active" communication to node red (port 2000). The receive from Node red is a passive connection (port 2001).
In my flow I have a "connect" indication and can send data from the PLC to node red. On the node red side, on the send (NR -> PLC) it shows a red box and "disconnected".

Is there something I am missing with the TCP out node that would otherwise force it to create an "active" connection with the PLC? Ive tried the same flow to another VM running a separate flow. All connected fine in both directions. This has been driving me crazy for a week and a half now. Ive tried every conceivable adjustment on the PLC side. Any suggestions on the NR side of things? I need to be able to do this as straight TCP and not with something like Modbus, S7, or MQTT.

Why not use the node-red-contrib-s7 which works great?

Eventually I must communicate with a DB (in or out of Node red). Because of this I need to figure out straight open TCP comms. I already tested MQTT and Im sure that S7 or Modbus would work but I will need straight TCP.

What db type is it that needs TCP?

I should have been clearer. DB = Data Base not an S7 data block. Preformed telegrams to the data base interface.

I assumed that is what you meant. Most databases types have node-red nodes to drive them, and those that don't should not require dropping down to the TCP level.

Finally found the problem on the Siemens side. Wrong connection structure is given for TCON in the help file. Now communicating open TCP in both directions.

Can you share a link to the Siemens forum which helped you and share your flows?

Here is the thread I ran on the Siemens forum to find the answer from that end. I found the problem was the wrong system data type for TCON.

I dont know how to export / import a flow (but would welcome an explanation). In light of that here is the graphical view.

As a side note, I also had MQTT working at one point between 1200 and NR

1 Like