Skip to main content

Async Modbus TCP client for Hisense i-Modkit VRF gateways

Project description

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 APIread_device, set_setpoint, set_mode, set_fan_speed, set_swing, set_dry_mode, turn_on/turn_off, prohibition locks, filter reset.
  • Bundled control writewrite_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 discoveryread_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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyacmodbus-1.0.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyacmodbus-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pyacmodbus-1.0.0.tar.gz.

File metadata

  • Download URL: pyacmodbus-1.0.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyacmodbus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 89effacb7805b7ab95bb919dee9d08545d7a129d2417137c3af12a12ae4b1ff7
MD5 293456d822cbae59032d5841673ca639
BLAKE2b-256 e1978f8895bf7a57da3bf73f5446e5fded99d52ee8ef74cc9381c5db21283d50

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyacmodbus-1.0.0.tar.gz:

Publisher: publish-pyacmodbus.yml on buchuman/hisense_vrf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyacmodbus-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyacmodbus-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyacmodbus-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2c618cad555173ed72466ff92a470b3593daa1eb13f9e7cf379ad9a24bf8758
MD5 2faee23ba4446b14bfe8dea1edf5b77a
BLAKE2b-256 d2ebbbdafb010cfbfde6bca215beecc25cda475e500655057182145395dab085

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyacmodbus-1.0.0-py3-none-any.whl:

Publisher: publish-pyacmodbus.yml on buchuman/hisense_vrf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page