Node-RED Siemens S7 PLC Communication

1.1.6 · active · verified Sun Apr 19

node-red-contrib-s7comm is a Node-RED package designed to facilitate communication with Siemens SIMATIC S7-300, S7-1200, and S7-1500 PLCs. It leverages the RFC1006 (ISO-on-TCP) communication protocol, enabling users to read from and write to specific PLC addresses using various S7 data types. The current stable version is 1.1.6. As a Node-RED contribution node, its release cadence is typically driven by community contributions and updates to its underlying `nodeS7` library, which handles the core PLC communication. Key differentiators include its integration into the Node-RED flow-based programming environment, simplifying the creation of HMI, SCADA, or IIoT applications that interact with Siemens PLCs without requiring extensive low-level protocol knowledge. It abstracts the complexities of the S7comm protocol behind user-friendly Node-RED nodes.

Common errors

Warnings

Install

Imports

Quickstart

Illustrates the typical installation process for Node-RED packages via the Palette Manager and provides a conceptual JavaScript snippet for direct S7 client interaction (not directly from this Node-RED node).

// To install the Node-RED node:
// 1. Ensure Node-RED is installed and running.
// 2. Open the Node-RED editor (usually http://localhost:1880).
// 3. Go to the Palette Manager (top-right menu -> Manage palette).
// 4. In the 'Install' tab, search for 'node-red-contrib-s7comm' and click install.

// After installation, drag 's7comm read' and 's7comm write' nodes from the palette onto your flow.
// Example JavaScript code showing conceptual S7 client usage, not direct 'node-red-contrib-s7comm' usage:

// import { S7Client } from 'nodeS7'; // Hypothetical import if using nodeS7 directly

// async function readS7Data() {
//   const client = new S7Client();
//   try {
//     await client.connect({
//       host: '192.168.0.1',
//       port: 102,
//       rack: 0,
//       slot: 1
//     });
//     console.log('Connected to PLC.');

//     const data = await client.readArea(
//       S7Client.S7Area.DB,
//       1, // DB number
//       0, // Start offset
//       2, // Length (e.g., 2 bytes)
//       S7Client.S7Type.WORD
//     );
//     console.log('Read data:', data);
//   } catch (error) {
//     console.error('S7 communication error:', error);
//   } finally {
//     client.destroy();
//   }
// }

// readS7Data();

view raw JSON →