open_port
Open a serial connection to a device and start buffering incoming data. Configure communication parameters like baud rate, parity, and stop bits for reliable data exchange.
Instructions
Open a serial port and start buffering everything it sends.
Idempotent: opening an already-open port with the same settings just returns its status; different settings close and reopen it. The port stays open until close_port.
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://. | |
| parity | No | N=none, E=even, O=odd, M=mark, S=space. | N |
| baudrate | No | Bits per second, e.g. 9600, 115200, 921600. | |
| bytesize | No | Data bits: 5, 6, 7 or 8. | |
| encoding | No | Text encoding used to decode/encode data (utf-8, latin-1, ascii...). | utf-8 |
| stopbits | No | 1, 1.5 or 2. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | Yes | ||
| error | No | Set when the device disconnected or failed. | |
| parity | Yes | ||
| baudrate | Yes | ||
| bytes_rx | Yes | ||
| bytes_tx | Yes | ||
| bytesize | Yes | ||
| encoding | Yes | ||
| stopbits | Yes | ||
| uptime_s | Yes | ||
| connected | Yes | ||
| unread_bytes | Yes | Bytes buffered and not yet consumed by read/read_until/query. | |
| dropped_bytes | Yes | Bytes discarded because the buffer overflowed. |