Skip to content

Repository files navigation

EdgeCommons Modbus Adapter

The Python reference southbound protocol adapter, built on the edgecommons (edgecommons) library and the southbound contract (docs/SOUTHBOUND.md in the edgecommons monorepo). It bridges Modbus devices — TCP, serial RTU, and RTU-over-TCP — onto a message bus: it polls register maps and republishes value changes as SouthboundSignalUpdate messages on the Unified Namespace data class (ecv1/{device}/modbus-adapter/{instance}/data/{signal}), serves on-demand reads/writes/control through the library command inbox (sb/read, sb/write, sb/status, sb/signals, sb/browse, sb/pause, sb/resume, reconnect, repoll), gates writes by a per-signal writes.allow[] allow-list, emits evt-class connection/write events (through the library's data()/events() facades), and reports southbound_health plus Modbus operational metrics for connection, inventory, polling, publishing, and commands. It runs wherever you deploy it — a Greengrass v2 component, a standalone process, or a Kubernetes pod.

Sibling of the Java OPC UA reference adapter; same southbound contract, the poll-based counterpart to OPC UA's subscribe-based model.

Status

The implemented Python adapter supports TCP, serial RTU and RTU-over-TCP acquisition, scoped southbound commands and the shared health model. Registry beta is a maturity label, not a fresh validation result. The tutorial provides a protobuf-aware simulator walkthrough; the older JSON-wire clients in validation/ require repair before serving as current conformance gates. See the validation guide. This documentation review (2026-09-06) did not rerun hardware, serial or deployed Greengrass tests.

Quick start (local, against the simulator)

pip install -e . -r requirements-test.txt
python validation/modbus_sim_server.py &          # pymodbus TCP slave
python main.py --platform HOST --transport MQTT validation/messaging-local.json \
       -c FILE validation/config.json -t modbus-thing

Subscribe to ecv1/+/+/+/data/# to watch telemetry (and ecv1/+/+/+/state, ecv1/+/+/+/metric/# for the keepalive, health, and operational metrics). For local dev against the sibling edgecommons UNS library, install it editable into the venv first: pip install -e ../core/libs/python, then pip install -e . -r requirements-test.txt.

Tests

python -m pytest          # unit suite (codec / config / coalescing / commands / publisher / events),
                          # with the org 90% coverage gate (scoped to the CI-testable surface; see .coveragerc)

About

Modbus southbound adapter (Python/pymodbus) for the edgecommons ecosystem

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages