read_until
Read serial data until a specific pattern like 'OK' or 'ready>' arrives, returning the full response including the pattern. If timeout occurs, returns any data received with matched=false.
Instructions
Wait until a pattern appears (e.g. 'OK', 'ready>', 'Temperature:') and return everything up to and including it. On timeout returns whatever arrived, with matched=false.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | Yes | Port device from list_ports (e.g. /dev/cu.usbserial-0001, /dev/ttyUSB0, COM3), or a pyserial URL such as socket://host:port, rfc2217://host:port or loop://. | |
| regex | No | Interpret `pattern` as a Python regex. | |
| pattern | Yes | Substring to wait for, or a regex when regex=true. | |
| timeout_s | No | Give up after this many seconds. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| bytes | Yes | ||
| error | No | ||
| matched | Yes | False if the timeout expired before the pattern appeared. | |
| elapsed_s | Yes |