RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • RuleGo-MCP-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
  • 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
  • RuleGo-MCP-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
  • 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

    • transform

    • external

    • ai

    • ci

    • IoT

      • OPC_UA Subscribe
      • OPC_UA Read
      • OPC_UA Write
      • Modbus Node
      • Serial Communication
        • Component List
        • Common Configuration
        • 1. Serial In (x/serialIn)
          • Specific Configuration
        • 2. Serial Out (x/serialOut)
          • Specific Configuration
          • Input Message
        • 3. Serial Request (x/serialRequest)
          • Specific Configuration
        • 4. Serial Control (x/serialControl)
          • Specific Configuration
          • Input Message
    • Stream Processing

    • file

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

  • en
  • Extension Components
  • IoT
rulego-team
2026-01-29
目录

Serial Communication

# Serial Communication Component

The RuleGo IoT component library provides serial communication support, allowing rule chains to interact with serial devices. It provides four functional components: read, write, request, and control.

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

# Component List

Component Name Type Description
Serial In x/serialIn Reads data from a serial port. Supports splitting data by character, timeout, or fixed length.
Serial Out x/serialOut Writes data to a serial port. Supports automatically appending trailing characters.
Serial Request x/serialRequest Writes data and waits for a response (blocking). Supports timeout and response splitting logic.
Serial Control x/serialControl Controls the serial port connection status (open/close).

# Common Configuration

All serial components share the following connection configuration:

Field Description Example
port Serial port name, e.g., COM1 (Windows) or /dev/ttyUSB0 (Linux) COM3
baudRate Baud rate 9600
dataBits Data bits 8
stopBits Stop bits ("1", "1.5", "2") 1
parity Parity (N: None, O: Odd, E: Even, M: Mark, S: Space) N
dtr DTR control (true, false) true
rts RTS control (true, false) false

Note: Multiple nodes with the same port will share the same underlying connection instance.

# 1. Serial In (x/serialIn)

Used to read data from a serial port. The read operation is triggered when an input message is received (usually used with a timer).

# Specific Configuration

Field Description Default
startChar Start character. If set, discards data until this character is matched. -
splitType Split type: char (by character), timeout (by timeout), fixed (by length) timeout
splitKey Split parameter. Delimiter if split by char (e.g., \n); number of bytes if split by length. -
splitTimeout Read segment timeout (ms). If no data for this duration, segment ends. 100
dataType Output data type: text (UTF-8), binary, hex, base64 text

# 2. Serial Out (x/serialOut)

Used to write data to a serial port.

# Specific Configuration

Field Description Default
data Send content, supports dynamic variable replacement (e.g., ${data}). If empty, msg.Data is used. -
addChar Append character. Automatically appended to data when sending (supports \n, \r, etc.). \r\n
dataType Input data type: text (default), hex, base64. If not text, the data will be decoded before sending. text

# Input Message

If the data configuration is empty, msg.Data will be used as the content to send.

# 3. Serial Request (x/serialRequest)

Used for "Request-Response" pattern. Sends data first, then blocks waiting for a response.

# Specific Configuration

Includes data, addChar, dataType from Serial Out and all split configurations from Serial In (startChar, splitType, dataType, etc.), plus:

Field Description Default
requestTimeout Total request timeout (ms). 10000

# 4. Serial Control (x/serialControl)

Used to manually control the serial connection.

# Specific Configuration

Field Description Default
action Control instruction, supports dynamic variable replacement (e.g., ${msg.action}). If empty, msg.Data is used as the instruction. close

# Input Message

If the action configuration is empty, msg.Data content is used as the control instruction:

  • open: Open the serial connection (normally the component opens it automatically, this is for manual reconnection).
  • close: Close the serial connection.
  • dtr=1: Set DTR signal to High.
  • dtr=0: Set DTR signal to Low.
  • rts=1: Set RTS signal to High.
  • rts=0: Set RTS signal to Low.
  • flush: Clear both input and output buffers.
  • flush_in: Clear input buffer.
  • flush_out: Clear output buffer.
Edit this page on GitHub (opens new window)
Last Updated: 2026/02/04, 10:50:11
Modbus Node
Stream Processing

← Modbus Node Stream Processing→

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

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