Skip to main content

moat-modbus

% start synopsis % start main

This is an anyio-enabled async Modbus client/server, built on the sans-IO protocol core moat-lib-modbus (no pymodbus dependency).

% end synopsis

Usage

Check the example client and server for rudimentary usage.

Documentation patches gladly accepted.

Background

moat-modbus diverges from pymodbus in that it does not expose a "data store" context to the user. Instead, every bus value is a separate object, with arbitrary length and encapsulating its own encoding and decoding rules.

A Modbus server exposing writeable registers only needs to

  • register the value in question
  • wait for it to be written to

The rest happens behind the scenes.

Device Server

As some Modbus devices only allow ine server at a time, MoaT's Modbus supports a simple bidirectional gateway.

How to get there:

  • Write a generic device description. Put it in the modbus-data repository.
  • Add an interface overlay that describes which topic to send the data to / which topic to read.
  • Run moat modbus dev poll FILE.yaml. You can use a generic systemd service if you copy the file to /etc/moat/modbus.

The values can be modified (factor+offset); the gateway works in both directions (command/state).

Bus log

MoaT-Modbus can write a structured log of the Modbus messages on a bus: moat modbus monitor --log FILE (with --log-check SECONDS to follow log rotation instead of creating the file), or log entries in a poller's configuration (see {doc}dev-poll). Each record contains the device name, a sequence number, the wall-clock time, and the decoded message. Several loggers may append to the same file.

moat modbus log FILE… prints the records, merged by time, one per line; with --long, in detail and with the time since the previous record.

Both moat modbus monitor and moat modbus log accept --delta: only values that are new or have changed are shown, per device, unit, function and address, e.g. u3 RH 513=0->1. Errors are shown when they first occur.

% end main

MQTT / MoaT-KV interface

MoaT-Modbus includes a server that's informed by a device profile. This server acts as a bidirectional gateway from and to MQTT and/or MoaT-KV storage.

See "gateway.rst" for details.

TODO

  • configurable codecs
  • get/set attributes
  • pack multiple values into a message
  • read-after-write if no slot

Metadata

Release files for moat-modbus 0.10.6

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

Source distribution (sdist)

Source distribution for moat-modbus 0.10.6
File Size Uploaded Provenance Actions
moat_modbus-0.10.6.tar.gz 55.0 kB Without provenance Details for moat_modbus-0.10.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moat-modbus 0.10.6
File Interpreter ABI Platform Actions
moat_modbus-0.10.6-py3-none-any.whl Python 3 none any Details for moat_modbus-0.10.6-py3-none-any.whl

Total release size: 110.9 kB

Release files / moat_modbus-0.10.6.tar.gz

Download URL moat_modbus-0.10.6.tar.gz
Size 55.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bc49d30920ba72bc6a17060fc99f67d48ec72b210ea49a6592c7b0712c8611e9
BLAKE2b-256 checksum
How to use checksums
725c9ec121e7e38d2c3fbaf640fce5a673a2f0b1fa31fe8e2e8a4dfa7561d67a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / moat_modbus-0.10.6-py3-none-any.whl

Download URL moat_modbus-0.10.6-py3-none-any.whl
Size 55.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de1e5d1e06158136fdb0d4194afeda2f62d6dbc80630a4dc5f117a589baff3b6
BLAKE2b-256 checksum
How to use checksums
dfa6eb60f4555ad9e3631f788620a959e3bc2de67a34d38187d89309372da63a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for moat-modbus 0.10.6

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.10.6 This release

2 release files No 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