serial_send
Send serial data to a device and wait for an expected response. Supports AT command newlines, regex matching, timeouts, and HEX mode for Modbus/RS485.
Instructions
向串口发送数据并等响应。newline=True 自动追加 \r\n(AT 指令必须!)。 expect:正则,如 "OK"——发 AT 后等到 OK/ERROR 立即返回,不傻等; wait_s:等待响应上限秒数(默认 0.5,AT 慢响应建议 3~5)。 hex_mode=True 时 data 按 HEX 解析(RS485/Modbus 用)。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| expect | No | ||
| handle | Yes | ||
| wait_s | No | ||
| newline | No | ||
| hex_mode | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |