Skip to main content

eletechsup-modbus-library

Async Modbus RTU protocol library for Eletechsup modules. It owns the register map, the value decoding and the write rules; it does not own the transport and does not depend on Home Assistant.

The first supported family is 10IOAXX — industrial IO modules with N opto-isolated inputs and N relays on RS485. A family is described once: the register-map layout, the link parameters, the correction kind and the service block live in a DeviceFamily, while each model's profile points at it and declares only what differs — channel counts, product IDs, analog channels and hardware variants. A caller that builds a form before reading a device asks family_for("10ioaxx") for the baud rates and the address range.

Installation

pip install eletechsup-modbus-library

Python 3.14 or newer is required. The library builds on modbus-connection and passes its tests on the in-memory backend shipped with it.

Usage

The caller owns the Modbus unit — a serial port, a TCP gateway, or the Home Assistant modbus integration. The library never opens or closes a connection.

from eletechsup_modbus_library import EletechsupDevice, Parity, RelationMode, require_profile

device = EletechsupDevice(unit, require_profile("10IOA04"))

await device.async_update_state()
first_relay = device.digital_output(0)

await device.async_set_digital_output(0, on=True)
await device.async_set_relation(RelationMode.INTERLOCKING_PAIR)

await device.async_set_auto_report(0)  # 0 disables the unsolicited reports
await device.async_set_return_time(20)  # answer delay, in the family's steps
await device.async_write_link_settings(baudrate=19200, parity=Parity.EVEN)
await device.async_write_digital_outputs_mask(0b1001)  # whole mask, verified by a read
await device.async_read_raw()  # raw registers for diagnostics, cache untouched

Writing the bus address is part of the same object, but only when the family allows it: async_write_bus_address() raises UnsupportedOperationError on 10IOAXX, where switches set the address, and ValueOutOfRangeError for an address outside the family's range.

Reading is split on purpose: async_update_state() is two single-register reads of the output and input masks, async_update_settings() is one request for the settings block. A slow or unreachable device therefore never hides the state that was read successfully.

Writing is verified. Every settings write is followed by a read-back, and a device that acknowledges a write but keeps another value raises ValueNotStoredError instead of pretending success. The only exception is the factory reset: after it the device changes speed, parity and address, so a read-back would fail for reasons that are not an error.

Supported devices

Model Inputs Relays Product ID
10IOA01 1 1 1001
10IOA02 2 2 1002
10IOA04 4 4 1004
10IOA08 8 8 1008
10IOA12 12 12 1012

Catalogue articles such as 10IOA0112VR differ in power supply and enclosure only; the protocol is the same, so profiles use the base model name.

Dependencies

The lower bound is modbus-connection>=4.12.4, which is exactly what the modbus integration of Home Assistant 2026.10.4 pins (modbus-connection[tmodbus]==4.12.4). That is also the target Home Assistant: it is the newest release pytest-homeassistant-custom-component supports today, and raising the target would break the integration's test stack until the plugin catches up. Newer releases stay compatible — 2026.11.0 pins 4.12.7, 2026.11.3 pins 4.12.8, both inside the range — while 2026.10.0 pins 4.12.3 and is not supported: installing there would force an upgrade of a dependency Home Assistant pins exactly (2026.10.1–2026.10.4 pin 4.12.4, so they are fine). CI runs the suite twice: against the floor, read from pyproject.toml, and against the latest release.

Protocol notes

  • Defaults: 9600 baud, 8 data bits, no parity, 1 stop bit. The address range and its writability are declared by the family: 10IOAXX uses 1–63 and switches, so async_write_bus_address() refuses before a frame.
  • Outputs are read from the holding register 0x0080 and written as single coils; inputs are read from 0x0090. A short input pulse can fall between two polls — the device does not latch it.
  • Changing baud rate or parity is stored immediately but takes effect only after a power cycle.
  • The factory reset (0x00FB) is available as a method but is not exposed by the integration.

Device facts, the register map and the differences between firmware versions are documented in the library documentation. The cross-family picture is in the family overview.

Development

python -m pytest --cov=eletechsup_modbus_library
ruff format --check .
ruff check .
mypy src

Pytest plugins come from their entry points. If PYTEST_DISABLE_PLUGIN_AUTOLOAD is set in the environment, pass them explicitly: python -m pytest -p pytest_asyncio.plugin -p pytest_cov.plugin -p modbus_connection.pytest_plugin.

The transport is mocked on its boundary with the in-memory backend, so the tests need neither hardware nor a serial port. The change's tasks.md names the requirement behind each test group; scenarios that only a real device can show — reset behaviour, baud rate taking effect after a power cycle, the input-to-output link — are marked there as live checks.

License

MIT — see LICENSE.

Metadata

Release files for eletechsup-modbus-library 0.3.0

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

Source distribution (sdist)

Source distribution for eletechsup-modbus-library 0.3.0
File Size Uploaded Provenance Actions
eletechsup_modbus_library-0.3.0.tar.gz 33.2 kB With provenance Details for eletechsup_modbus_library-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eletechsup-modbus-library 0.3.0
File Interpreter ABI Platform Actions
eletechsup_modbus_library-0.3.0-py3-none-any.whl Python 3 none any Details for eletechsup_modbus_library-0.3.0-py3-none-any.whl

Total release size: 53.9 kB

Release files / eletechsup_modbus_library-0.3.0.tar.gz

Download URL eletechsup_modbus_library-0.3.0.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
85c4a1454d02554bb3a67cf9f893ca898fa82a364926a006f5c74f92320efc80
BLAKE2b-256 checksum
How to use checksums
aeada6e30b4569c021a9be0748748cfd9221ad8eb7c6b167af94e14ae650b3ff
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 Nov 30, 2026.

Transparency log

Release files / eletechsup_modbus_library-0.3.0-py3-none-any.whl

Download URL eletechsup_modbus_library-0.3.0-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ac7d6ebca4ebba5826923b9be40a002d703c995c667157d3fd0e9355c96882d
BLAKE2b-256 checksum
How to use checksums
d9eb3ae0b656cff5dd451623a34d30026288dfeac5046e3aced6866b3e779242
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 Nov 30, 2026.

Transparency log

Security for eletechsup-modbus-library 0.3.0

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.

Select from 2 files

Attestation for eletechsup_modbus_library-0.3.0.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 Nov 30, 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.

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