PyModbus implements the Modbus protocol with synchronous and asynchronous clients and servers, plus an HTML-based device simulator.
Overview
PyModbus is a Python implementation of the standard Modbus protocol. It bundles a client for talking to field devices, a server for emulating or hosting devices, and a simulator with a web interface for configuring and monitoring virtual equipment.
The stack supports serial RS-485, TCP, TLS, and UDP, along with common frame types including RTU, ASCII, and socket modes. Optional pyserial handles serial links. Clients expose both sync and async APIs with helpers to map Python values to register blocks. Servers offer synchronous wrappers over async internals, configurable datastores, and hooks to observe traffic.
The simulator lets teams model device register layouts, watch live traffic, and rehearse error or fault responses that are hard to trigger on hardware. It can be launched from an installed entry point with JSON-driven device definitions and a configurable HTTP port for the UI.
Typical uses include embedding a client in automation software such as home-assistant, standing up a test server to validate an integration, or stress-testing many simulated devices on small hosts like a Raspberry Pi.
Key features
- Full standard Modbus protocol coverage
- Sync and async client APIs
- High-performance async server
- HTML Modbus simulator
- Serial, TCP, TLS, and UDP transport
- Custom function code support
- Register conversion utilities
- Optional pyserial dependency
Use cases
- Industrial device integration in Python apps
- home-assistant Modbus connectivity
- Verifying client logic against a test server
- Distributed virtual device testing
- High-volume multi-device simulation