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
        • S7 Write
          • Configuration
            • Point fields
          • Point fields
          • Input
          • Features
          • Relation Type
          • Example
        • 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 Write

x/s7Write component: v0.37.0+ Batch writes a list of point values to Siemens S7 series PLCs (S7-200SMART/300/400/1200/1500). A successful write is 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 None
addr string Siemens address (see syntax below); supports ${msg.xx} None
type string Data type, see options below None
value string Value to write (as a string); supports ${msg.xx} 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 Value format
BOOL 1 Boolean; value accepts true/false/0/1; use a bit address (e.g. DB1.DBX0.1, M0.1); implemented as read-modify-write
BYTE 1 Unsigned byte
INT 2 Signed 16-bit integer
WORD 2 Unsigned 16-bit integer
DINT 4 Signed 32-bit integer
DWORD 4 Unsigned 32-bit integer
REAL 4 32-bit float
LREAL 8 64-bit float
STRING 256 S7 string; content longer than 254 bytes is truncated

# Input

Points to write are read from msg.Data (a JSON array); if msg.Data is empty, the configured points are used instead. Each point object has these fields:

Field Type Description
name string Point name (optional)
addr string Siemens address, e.g. DB1.DBD8, M10.5
type string Data type
value string Value to write; supports ${msg.xx}
scale float Scale factor (optional)
offset float Offset (optional)

Example msg.Data:

[{"addr":"DB1.DBD8","type":"REAL","value":"23.5"}]
1

# Features

  • Periodic writes: Place an endpoint/schedule endpoint before this node to trigger it on a schedule. For on-demand writes, an upstream node may inject the points list via msg.Data.
  • Template variables: Point fields such as addr and value 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 write failure triggers an automatic reconnect and retry, up to 3 times (maxRetries=3). Any single point failure fails the overall operation and routes to Failure.

# 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_write_demo",
    "name": "S7 write demo",
    "root": true,
    "debugMode": false
  },
  "metadata": {
    "firstNodeIndex": 0,
    "nodes": [
      {
        "type": "x/s7Write",
        "name": "Write PLC data",
        "debugMode": false,
        "configuration": {
          "server": "192.168.1.100:102",
          "rack": 0,
          "slot": 1,
          "timeout": 5,
          "points": [
            {"name":"setTemp","addr":"DB1.DBD0","type":"REAL","value":"${msg.setTemp}"},
            {"name":"start","addr":"M10.5","type":"BOOL","value":"true"}
          ]
        }
      }
    ],
    "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
Edit this page on GitHub (opens new window)
Last Updated: 2026/07/29, 07:07:39
S7 Read
EtherNet/IP Read

← S7 Read EtherNet/IP Read→

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

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