RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

  • Extension Components

    • Extension Components Overview
    • filter

    • action

    • transform

    • external

    • ai

    • ci

    • IoT

      • IoT Components Overview
      • Input Endpoints

      • Protocol Acquisition

        • OPC_UA Read
        • OPC_UA Write
        • Modbus Node
        • Serial Communication
        • S7 Read
          • Configuration
            • Point fields
          • Point fields
          • Output
          • Features
          • Relation Type
          • Example
        • S7 Write
        • EtherNet/IP Read
        • EtherNet/IP Write
        • SNMP Read
        • SNMP Write
        • Modbus Read Points Node
        • Modbus Write Points Node
        • Universal Acquisition Read
        • IoT Write
        • IEC 104 Read
        • IEC 104 Write
        • FINS Node
        • FINS Read
        • FINS Write
        • MC Node
        • MC Read
        • MC Write
        • DL/T 645 Node
        • DL/T 645 Read
        • DL/T 645 Write
      • Time-Series Database

      • 控制

      • IoT Scenarios
    • Stream Processing

    • Service Discovery

    • file

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • Agent Framework

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

目录

S7 Read

x/s7Read component: v0.37.0+ Batch reads point data from Siemens S7 series PLCs (S7-200SMART/300/400/1200/1500). Results are written back to msg.Data and forwarded via the Success chain.

Additional extension library required: rulego-components-iot (opens new window)

# Configuration

Field Type Description Default
server string PLC address in host:port format; the ISO-on-TCP default port is 102 127.0.0.1:102
rack int Rack number 0
slot int CPU slot: S7-1200/1500/200SMART=1, S7-300/400=2 1
timeout int Request timeout in seconds 5
points []object Default points table; points supplied via msg.Data take precedence when valid []

# Point fields

Field Type Description Default
name string Point name (included in the output for downstream access) None
addr string Siemens address (see syntax below); supports ${msg.xx} None
type string Data type, see options below None
scale float Optional scale factor; engineering value = raw value × scale + offset -
offset float Optional offset -
endian string Optional byte order -

# Point fields

addr field: Uses Siemens address syntax; supports ${msg.xx} template variables.

  • DB area: DB<n>.<DBX|DBB|DBW|DBD><offset>[.bit], e.g. DB1.DBD0, DB1.DBW2, DB1.DBX0.1
  • M/I/Q areas: word/dword addresses such as MW0, MD0, IW0, QW0; bit addresses such as M0.1

Data type options:

Type Bytes Go output type Description
BOOL 1 bool Boolean, use a bit address (e.g. DB1.DBX0.1, M0.1)
BYTE 1 byte Byte
INT 2 int16 Signed 16-bit integer (big-endian)
WORD 2 uint16 Unsigned 16-bit integer (big-endian)
DINT 4 int32 Signed 32-bit integer (big-endian)
DWORD 4 uint32 Unsigned 32-bit integer (big-endian)
REAL 4 float32 32-bit float (big-endian)
LREAL 8 float64 64-bit float (big-endian)
STRING 256 string S7 string (first byte = max length, second byte = actual length)

# Output

Read results are reassigned to msg.Data and forwarded via the Success chain as an array:

Field Type Description
name string Point name
value any Read value; its concrete type depends on the point type
timestamp string Read time (RFC3339)
error string Error message; empty on success (a single point failure does not affect other points)

Example:

[
  {"name":"temperature","value":25.6,"timestamp":"2026-07-23T10:00:00Z","error":""},
  {"name":"running","value":true,"timestamp":"2026-07-23T10:00:00Z","error":""}
]
1
2
3
4

# Features

  • Periodic collection: Place an endpoint/schedule endpoint before this node to trigger it on a schedule, and configure points in points below. For on-demand reads, an upstream node may inject points via msg.Data.
  • Template variables: Point fields such as addr support ${msg.xx} / ${metadata.xx} templates.
  • Dynamic points precedence: When msg.Data carries a valid points JSON array, it takes precedence; otherwise the configured points are used.
  • Chain-scoped connection pool: Other S7 nodes in the same chain may reuse an established TCP connection via ref://nodeID to avoid duplicate connections.
  • Failure reconnect/retry: A connection-level failure (all points failed) triggers an automatic reconnect and retry, up to 3 times (maxRetries=3). A single point failure is flagged with an error message and does not interrupt the overall flow.

# Relation Type

  • Success: Execution succeeds; the message is sent to the Success chain.
  • Failure: Execution fails; the message is sent to the Failure chain.

# Example

{
  "ruleChain": {
    "id": "s7_read_demo",
    "name": "S7 read demo",
    "root": true,
    "debugMode": false
  },
  "metadata": {
    "firstNodeIndex": 0,
    "nodes": [
      {
        "type": "x/s7Read",
        "name": "Read PLC data",
        "debugMode": false,
        "configuration": {
          "server": "192.168.1.100:102",
          "rack": 0,
          "slot": 1,
          "timeout": 5,
          "points": [
            {"name": "temperature", "addr": "DB1.DBD0", "type": "REAL"},
            {"name": "counter", "addr": "DB1.DBD4", "type": "DINT"},
            {"name": "running", "addr": "M10.5", "type": "BOOL"}
          ]
        }
      }
    ],
    "connections": []
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Edit this page on GitHub (opens new window)
Last Updated: 2026/07/29, 07:07:39
Serial Communication
S7 Write

← Serial Communication S7 Write→

Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式