Async Modbus TCP client for Hisense i-Modkit VRF gateways
Project description
pyacmodbus
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 globalasyncio.Lock— the i-Modkit accepts only one TCP connection at a time. - Typed data model (
ACDeviceState,GatewayState,OutdoorUnitState) —dataclass-based, fully annotated,py.typedmarker 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89effacb7805b7ab95bb919dee9d08545d7a129d2417137c3af12a12ae4b1ff7
|
|
| MD5 |
293456d822cbae59032d5841673ca639
|
|
| BLAKE2b-256 |
e1978f8895bf7a57da3bf73f5446e5fded99d52ee8ef74cc9381c5db21283d50
|
Provenance
The following attestation bundles were made for pyacmodbus-1.0.0.tar.gz:
Publisher:
publish-pyacmodbus.yml on buchuman/hisense_vrf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyacmodbus-1.0.0.tar.gz -
Subject digest:
89effacb7805b7ab95bb919dee9d08545d7a129d2417137c3af12a12ae4b1ff7 - Sigstore transparency entry: 1624802690
- Sigstore integration time:
-
Permalink:
buchuman/hisense_vrf@509e78f2db39910de0b15d624eff7eb081ccf536 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/buchuman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pyacmodbus.yml@509e78f2db39910de0b15d624eff7eb081ccf536 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2c618cad555173ed72466ff92a470b3593daa1eb13f9e7cf379ad9a24bf8758
|
|
| MD5 |
2faee23ba4446b14bfe8dea1edf5b77a
|
|
| BLAKE2b-256 |
d2ebbbdafb010cfbfde6bca215beecc25cda475e500655057182145395dab085
|
Provenance
The following attestation bundles were made for pyacmodbus-1.0.0-py3-none-any.whl:
Publisher:
publish-pyacmodbus.yml on buchuman/hisense_vrf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyacmodbus-1.0.0-py3-none-any.whl -
Subject digest:
d2c618cad555173ed72466ff92a470b3593daa1eb13f9e7cf379ad9a24bf8758 - Sigstore transparency entry: 1624802695
- Sigstore integration time:
-
Permalink:
buchuman/hisense_vrf@509e78f2db39910de0b15d624eff7eb081ccf536 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/buchuman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pyacmodbus.yml@509e78f2db39910de0b15d624eff7eb081ccf536 -
Trigger Event:
workflow_dispatch
-
Statement type: