Skip to main content

pywaveshare

Asynchronous Python library for connecting to, inspecting, controlling, and exposing serial proxy transports for Waveshare Network RS232/RS485/RS422 adapters running standard Waveshare / ZLAN (VirCom) firmware (such as RS485 TO ETH (B), RS485 TO POE ETH (B), RS232 TO ETH (B), RS232/485/422 TO POE ETH (B), and multi-channel 2-CH / 4-CH / 8-CH RS485 TO ETH (B) models).

Features

  • Device Discovery & State Inspection:
    • Broadcast LAN discovery and unicast status polling over UDP management port 1092 (170-byte ZL / SSServerParam binary protocol).
    • Exposes device name, MAC address / Device ID, firmware version, hardware model, active TCP connection status, TX/RX byte counters, and current serial framing configuration.
  • Dynamic Serial Configuration:
    • Standard RFC 2217 (ConfigMode.RFC2217): Telnet Com Port Control (IAC SB 0x2C ... IAC SE) for on-the-fly baudrate, data bits, parity, stop bits, flow control, RTS/DTR modem pins, and buffer purge.
    • Waveshare 8-Byte Synchronous Baudrate (ConfigMode.WAVESHARE_8BYTE): Inline 55 AA 55 8-byte control frame.
    • ZLAN RealCom (ConfigMode.REALCOM): Native FA 10 FB 12-byte dynamic serial configuration and stream deframing (FA 07 ..., FA 01 01).
    • ZLAN Gen-2 Command Stream (ConfigMode.ZLAN_CMD_GEN2): 10-byte identification header (ED F2 A3 56 CA DB 91 84 B0 D7) with CRC-16 verification.
    • Out-of-Band UDP RAM Configuration (ConfigMode.UDP_1092): Updates serial parameters in device RAM via UDP port 1092 (5A 4C 03) without wearing flash or injecting bytes into transparent TCP streams.
  • Async Control API & Serial Proxy Transport:
    • Clean WaveshareClient API with connect(), device_info(), get_device_state(), serial_proxy_subscribe(), serial_proxy_configure(), serial_proxy_write(), serial_proxy_flush(), subscribe_serial_proxy_data(), and add_connection_closed_callback().
    • Native serialx transport (WaveshareSerial and WaveshareSerialTransport) and URI handler registration (register_waveshare_uri_handler) supporting both waveshare:// URIs and externally managed WaveshareClient instances.
    • Built-in asyncio transport and stream helpers (async_create_serial_connection and open_serial_connection).

Quick Start

1. Discover Devices & Query State

import asyncio
from pywaveshare import WaveshareClient, async_discover_devices

async def main() -> None:
    devices = await async_discover_devices(timeout=2.0)
    for dev in devices:
        print(f"Found {dev.name} ({dev.model}) at {dev.ip_address}:{dev.tcp_port} [{dev.mac_address}]")

    client = WaveshareClient("192.168.1.200", port=4196)
    await client.connect()
    info = await client.device_info()
    state = await client.get_device_state()
    print(f"Connected: {state.tcp_connected}, TX={state.txd_bytes}, RX={state.rxd_bytes}")
    await client.disconnect()

asyncio.run(main())

2. Async Serial Proxy Client

import asyncio
from pywaveshare import ConfigMode, SerialProxyParity, WaveshareClient

async def main() -> None:
    client = WaveshareClient(
        "192.168.1.200",
        port=4196,
        config_mode=ConfigMode.RFC2217,
    )
    await client.connect()

    unsub = client.subscribe_serial_proxy_data(
        lambda msg: print(f"Received on port {msg.instance}: {msg.data.hex()}")
    )

    await client.serial_proxy_subscribe(0)
    await client.serial_proxy_configure(
        0,
        baudrate=115200,
        parity=SerialProxyParity.NONE,
        stop_bits=1,
        data_size=8,
    )
    client.serial_proxy_write(0, b"\x01\x03\x00\x00\x00\x02\xc4\x0b")
    await client.serial_proxy_flush(0)

    unsub()
    await client.disconnect()

asyncio.run(main())

3. Using with serialx or Custom Integrator URI Schemes

from pywaveshare import WaveshareClient, register_waveshare_uri_handler
from serialx import open_serial_connection

# Register the waveshare:// scheme with serialx
unregister = register_waveshare_uri_handler()

# Connect directly via URI:
# reader, writer = await open_serial_connection(
#     url="waveshare://192.168.1.200:4196/?config_mode=rfc2217",
#     baudrate=115200,
# )

# Or pass an existing WaveshareClient instance:
# client = WaveshareClient("192.168.1.200", 4196)
# await client.connect()
# reader, writer = await open_serial_connection(
#     client=client,
#     baudrate=115200,
# )

Metadata

Release files for pywaveshare 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywaveshare 0.1.1
File Size Uploaded Provenance
pywaveshare-0.1.1.tar.gz 87.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pywaveshare 0.1.1
File Interpreter ABI Platform
pywaveshare-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 123.5 kB

Release files / pywaveshare-0.1.1.tar.gz

Download URL pywaveshare-0.1.1.tar.gz
Size 87.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c78bac21aadbcf7e519eef80d20873b020d3129ddb883fec630f640d47e90b28
BLAKE2b-256 checksum
How to use checksums
c4d4d4d6545c5de5c30f0b890f110af103db3c9183f9457d8dab4823f586d9b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / pywaveshare-0.1.1-py3-none-any.whl

Download URL pywaveshare-0.1.1-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca6813b01d6762b64d7dd7d39e3b1ab09e0754b795bead273820c17daed7d0f1
BLAKE2b-256 checksum
How to use checksums
795adb7f21e777b5b376e4a7a61915fe99ae36baeafbb52ce485ed9edf05fc31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for pywaveshare 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pywaveshare-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page