Skip to main content

pyacmodbus

PyPI version Python versions License: MIT

Async Modbus TCP client for Hisense i-Modkit VRF gateways (model HCPC-H2M1C). Built on top of pymodbus, with a typed data model and a register map tuned for the i-Modkit firmware quirks.

Originally extracted from the hisense_vrf Home Assistant custom integration; published standalone so other projects can drive the same gateway hardware.

Install

pip install pyacmodbus

Example

import asyncio
from pyacmodbus import ACModbusClient

async def main() -> None:
    client = ACModbusClient(host="10.0.0.5", port=502)
    await client.connect()
    try:
        units = await client.scan_devices()
        print(f"Discovered indoor units: {units}")
        for idx in units:
            state = await client.read_device(idx)
            print(f"  unit {idx}: running={state.is_running} "
                  f"setpoint={state.setpoint}°C inlet={state.inlet_temp}°C "
                  f"mode=0x{state.current_mode:02x}")
    finally:
        await client.disconnect()

asyncio.run(main())

Features

  • Async client (ACModbusClient) with a global asyncio.Lock — the i-Modkit accepts only one TCP connection at a time.
  • Typed data model (ACDeviceState, GatewayState, OutdoorUnitState) — dataclass-based, fully annotated, py.typed marker for downstream mypy.
  • Indoor read/write API — read_device, set_setpoint, set_mode, set_fan_speed, set_swing, set_dry_mode, turn_on/turn_off, prohibition locks, filter reset.
  • Bundled control write — write_control_block(idx, run, mode, fan, swing, temp) issues a single Modbus 0x10 frame against the 5 control registers (40078-40082); the firmware's recommended atomic ON-with-config flow.
  • Outdoor + gateway discovery — read_outdoor_connections, read_outdoor_unit, read_gateway, set_alarm_display, clear_eeprom.
  • Configurable timeout — _MODBUS_TIMEOUT_S = 1.5 (vs pymodbus's default 3 s) keeps the worst-case discovery time bounded.

Register map

See REGISTERS.md in the parent repo for the full register reference, cross-referenced against the i-Modkit Modbus Adapter manual.

Supported gateways

  • i-Modkit HCPC-H2M1C (Modbus TCP). Other Hisense gateways (KNX, BACnet) are not supported.

Related projects

  • hisense_vrf — Home Assistant integration that uses this library. Platinum quality scale.

License

MIT — see LICENSE.

Metadata

Release files for pyacmodbus 1.0.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 pyacmodbus 1.0.0
File Size Uploaded
pyacmodbus-1.0.0.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyacmodbus 1.0.0
File Interpreter ABI Platform
pyacmodbus-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / pyacmodbus-1.0.0.tar.gz

Download URL pyacmodbus-1.0.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
89effacb7805b7ab95bb919dee9d08545d7a129d2417137c3af12a12ae4b1ff7
BLAKE2b-256 checksum
How to use checksums
e1978f8895bf7a57da3bf73f5446e5fded99d52ee8ef74cc9381c5db21283d50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 24, 2026.

Transparency log

Release files / pyacmodbus-1.0.0-py3-none-any.whl

Download URL pyacmodbus-1.0.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2c618cad555173ed72466ff92a470b3593daa1eb13f9e7cf379ad9a24bf8758
BLAKE2b-256 checksum
How to use checksums
d2ebbbdafb010cfbfde6bca215beecc25cda475e500655057182145395dab085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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