SME ModbusSim
Simulate Modbus devices on your laptop. PCS, BMS, meters and sensors on TCP, UDP, TLS and serial,
with a live web UI.
A free, open-source Modbus TCP / RTU slave (server) simulator with a live web UI, for Windows, Linux and Docker. Simulate battery PCS, BMS, power meters, environment sensors — or any register map you describe in YAML — and watch the values change in the browser while a real Modbus master (your EMS, a gateway, modpoll, pymodbus…) reads and writes them.
Built on an asyncio protocol core written for this project, FastAPI and pyserial. No front-end build step.
SME ModbusSim is free and MIT-licensed, developed by smart-edge (智届科技) — custom development is available, see Commercial support & custom development.
Features
- Six transports — Modbus TCP, Modbus UDP, Modbus/TCP Security (TLS with client certificates and roles), RTU over TCP, serial RTU and serial ASCII, side by side (listeners).
- Many devices, one port — one listener serves many unit IDs, and one device can sit on several listeners.
- Own protocol core — function codes 01–06, 0F, 10, 16, 17 and 2B/0E with standard exceptions, plus serial diagnostics 07 / 08 / 0B / 0C / 11.
- All the data types —
bool/bit, 16 / 32 / 64-bit integers,float32/float64,string,enum, with byte / word order, scale and offset (points). - Realistic behavior — the PCS ramps to its set point, the BMS integrates SOC, the meter balances the site; sine, random walk, expressions, counters, pulses, CSV replay (behaviors).
- Templates — battery PCS, BMS, meter and sensor, SunSpec PV inverter / meter / DER / battery, your own user-local templates and "save device as template".
- Fault injection — delays, no response, exceptions, bad CRC, disconnects and more, from the UI, REST or presets (faults).
- Scan & record real devices — a read-only scan guesses datatypes and saves a template; record polls a device into a replay CSV (scan).
- Live web UI — live values over WebSocket, writes, trends, traffic log and statistics; edit devices in the UI, YAML or Excel; REST / WebSocket API; English / Japanese / Simplified Chinese.
- Runs anywhere — Windows exe, multi-arch Docker (amd64 / arm64 / arm/v7) with offline archives, or
pip install.
Not affiliated with, endorsed by, or certified by SunSpec Alliance. The
sunspec_pv_inverter(models 1, 103, 120-123, 160) andsunspec_meter(models 1, 203),sunspec_der(models 1, 701-705) andsunspec_battery(models 1, 802, 803) templates are generated from the public SunSpec model definitions (Apache-2.0) and implement SunSpec Modbus models. No vendor register maps are built in; import your own privately via Excel or user-local templates.
Screenshots
Quick start
Windows exe
Download sme-modbus-sim-v<version>-windows.exe from the Releases
page and run it. The browser opens the UI at http://127.0.0.1:8081/ .
Without -c the exe uses %USERPROFILE%\.sme-modbus-sim\config.yaml, created from the bundled demo site on the
first run, so File > Save keeps your changes across restarts.
Docker
docker run --rm -p 8081:8081 -p 5020:5020 -p 5021:5021 ghcr.io/smartedge-tech-dev/sme-modbus-sim
Images are published for linux/amd64, linux/arm64 and linux/arm/v7. Offline archives
(docker load -i) are attached to each release. Set -e TZ=Asia/Tokyo for a local clock (default UTC).
To use your own config: -v ./my.yaml:/app/configs/my.yaml ... -c configs/my.yaml.
Serial RTU and RTU over TCP
Serial RTU defaults to 19200 baud, 8E1 (type: rtu, port: COM5 or /dev/ttyUSB0). RTU over TCP serves RTU frames on a TCP port, for serial gateways and masters in RTU-over-TCP mode. Serial ASCII (type: ascii) defaults to 19200 baud, 7E1, and drops an unfinished frame after 1 s without characters (char_timeout).
listeners:
- {id: com1, type: rtu, port: COM5, baudrate: 19200, parity: E} # serial RTU, 8E1
- {id: gw1, type: rtu_over_tcp, host: 0.0.0.0, port: 5021} # RTU over TCP
Pass the serial adapter into the container with --device (Linux hosts; the container runs as a non-root user, so add the device group):
docker run --rm --device /dev/ttyUSB0 --group-add dialout -p 8081:8081 \
-v ./serial.yaml:/app/configs/serial.yaml ghcr.io/smartedge-tech-dev/sme-modbus-sim \
python -m sme_modbus_sim run -c configs/serial.yaml --host 0.0.0.0 --no-browser
Masters: modpoll -m rtu -b 19200 -d 8 -p even -a 1 -0 -r 0 -c 4 -t 4 COM6 (the other end of the serial link) and modpoll -m enc -p 5021 -a 4 -0 -r 0 -c 2 -t 3 127.0.0.1 (RTU over TCP).
One Windows PC: Windows has no built-in virtual COM port pair. Options: SerialLoom (free, MIT; builds on the Microsoft-signed usbip-win2 host controller, so the COM ports come from Windows' own usbser driver), a signed commercial virtual serial port driver, or two USB-RS485 adapters wired to each other (A-A, B-B). Windows' usbser driver starts the inter-byte timeout (ReadIntervalTimeout) before the first byte arrives, so a master that sets pyserial's inter_byte_timeout (modbus_tk does by default) reads 0 bytes whenever a reply takes longer than about one system timer tick (~16 ms); set it to None on the master side when testing over SerialLoom (SerialLoom#16, known limitations). Since SerialLoom 0.4.0, DTR reaches the other end as DSR and DCD (SerialLoom#17); RTS is not passed (CTS stays on), nor is BREAK. Virtual pairs may not pass RTS / DTR and do not pace bytes at the baud rate; com0com 3.0's 64-bit driver is not production-signed and does not load with Secure Boot on. To test RTU framing without any driver, use an rtu_over_tcp listener. On Linux, macOS and WSL2, an rtu listener with port: pty (and optionally link: /tmp/ttyV0) creates the virtual pair itself, with no driver; socat -d -d pty,raw,echo=0 pty,raw,echo=0 also works.
From source / pip
python -m venv .venv
.venv/bin/pip install -r requirements.txt # Windows: .venv\Scripts\pip
.venv/bin/python -m sme_modbus_sim run -c configs/demo-site.yaml
Open http://127.0.0.1:8081/ . Python 3.11 or newer.
| Command / option | Meaning |
|---|---|
sme-modbus-sim [run] |
Start the simulator (run is the default) |
-c, --config FILE |
YAML config (defaults to configs/demo-site.yaml; Windows exe: ~/.sme-modbus-sim/config.yaml) |
--host 0.0.0.0 |
Web UI bind address (default localhost only) |
--http-port 8081 |
Web UI port |
--no-browser |
Do not open the browser |
validate [-c] CONFIG |
Check a config file, including behavior expressions, and exit (0 = valid, 2 = error) |
templates |
List the device templates |
The demo config has four devices: a battery PCS (unit 1), a BMS (unit 2), a grid meter (unit 3) on Modbus TCP port 5020, and a room sensor (unit 4) reachable only through the RTU-over-TCP listener on port 5021.
Testing with a Modbus master
# modpoll (addresses are 1-based by default; -0 for protocol addresses)
modpoll -m tcp -p 5020 -a 1 -0 -r 0 -c 4 -t 4 127.0.0.1
modpoll -m enc -p 5021 -a 4 -0 -r 0 -c 2 -t 3 127.0.0.1 # RTU over TCP
from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient("127.0.0.1", port=5020)
client.connect()
print(client.read_holding_registers(0, count=2, device_id=1).registers)
client.write_register(0, 200, device_id=1) # PCS-1 p_setpoint = 20.0 kW (int16 x0.1)
client.close()
More simulators from smart-edge
SME ModbusSim is one of a series of free, MIT-licensed protocol simulators by smart-edge. They share the same web UI and conventions, so what you learn in one carries over to the others.
| Simulator | What it simulates | Docs |
|---|---|---|
| SME BACnetSim | BACnet/IP device simulator | Docs |
| SME ModbusSim (this project) | Modbus TCP / RTU / UDP / TLS slave (server) simulator | Docs |
| SME OCPPSim | OCPP 1.6J / 2.0.1 charging station (charge point) simulator | Docs |
All open-source tools from smart-edge: https://smartedge-tech.com/open-source/
Commercial support & custom development
SME ModbusSim is developed by smart-edge — Nanjing Smart-Edge Technology Co., Ltd. (南京智届科技有限公司, 智届科技). Since its founding in 2023 the company has developed end-to-end software for distributed energy resources such as solar, batteries and EVs, from equipment control to the cloud and electricity markets. Its products include the AERIS RA platform (リソースアグリゲーター向け) and an AC system (アグリゲーションコーディネーター) for the Japanese electricity markets. The team supports projects in Japanese, from requirements definition through design, implementation, operation and maintenance.
Services:
- Energy management systems (EMS), cloud and on-site
- RA / AC systems for electricity markets (JEPX, EPRX, OCCTO)
- Edge IoT and equipment-control software
- Equipment integration: Modbus, MQTT, BACnet, ECHONET Lite, OpenADR 2.0b
- Energy forecasting and data analytics
- Cloud infrastructure design, build and operation
Need a feature added to SME ModbusSim, or help integrating your devices or EMS? Get in touch:
- Website: https://smartedge-tech.com
- Contact page: https://smartedge-tech.com/contact/
- E-mail: business@smartedge-tech.com
License
Metadata
Release files for sme-modbus-sim 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sme_modbus_sim-0.3.5.tar.gz | 229.8 kB | With provenance | Details for sme_modbus_sim-0.3.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sme_modbus_sim-0.3.5-py3-none-any.whl | Python 3 | none | any | Details for sme_modbus_sim-0.3.5-py3-none-any.whl |
Total release size: 424.4 kB
Release files / sme_modbus_sim-0.3.5.tar.gz
| Download URL | sme_modbus_sim-0.3.5.tar.gz |
|---|---|
| Size | 229.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d76fe7ddbc6872cbd0ba5a48dbd0768e40d35205662c181cfb5b8db158722420
|
|
BLAKE2b-256 checksum How to use checksums |
9e47a2678d44614c021e658ed88835b177ad5b22231e237362821ed9fe13c7a3
|
| 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 Dec 1, 2026.
Transparency logRelease files / sme_modbus_sim-0.3.5-py3-none-any.whl
| Download URL | sme_modbus_sim-0.3.5-py3-none-any.whl |
|---|---|
| Size | 194.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37054c6ac3edd09edf0589b8f8efafe595c8372dae222e1ba413156d633cd1f4
|
|
BLAKE2b-256 checksum How to use checksums |
9260163da005e0b2812986409d455e98c1d95ca0356ecac98c35a85b421bb55f
|
| 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 Dec 1, 2026.
Transparency logSecurity for sme-modbus-sim 0.3.5
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
Both files in this release have been uploaded with provenance metadata.
Attestation for sme_modbus_sim-0.3.5.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 Dec 1, 2026.
Transparency logA 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.