Python Qube Heat Pump Client
Asyncio client for HR-energy Qube heat pumps via Modbus TCP. It powers the Qube heat pump integration in Home Assistant.
Installation
pip install python-qube-heatpump
Requires Python 3.12 or newer.
Usage
import asyncio
from python_qube_heatpump import QubeClient
async def main():
client = QubeClient("192.168.1.100", port=502, unit_id=1)
if not await client.connect():
raise SystemExit("Cannot reach the heat pump")
state = await client.get_all_data() # QubeState, or None when the connection failed
if state:
print(f"Status: {state.status}")
print(f"Outside temp: {state.temp_outside}°C")
print(f"Supply temp: {state.temp_supply}°C")
print(f"DHW temp: {state.temp_dhw}°C")
await client.close()
asyncio.run(main())
Features
- Async Modbus TCP client on modbus-connection (tmodbus backend): it opens its own connection, or uses a
ModbusUnitfrom a shared connection such as Home Assistant's (QubeClient(host, unit=unit)) - Read retries: a block read whose response went missing or arrived garbled is tried once more; writes are never retried
- Batched reads:
get_all_data()andget_all_entities()read neighbouring registers in a handful of block transactions instead of one request per register - Entity definitions for sensors, binary sensors, and switches
- Validated writes:
write_switch(), andwrite_setpoint()within each register'smin_value/max_value - SG Ready:
get_sg_ready_mode()/set_sg_ready_mode()with the modesoff,block,plusandmax - Unified status:
QubeState.statuscombines the status code with the anti-legionella request (resolve_status()) - FLOAT32 decoding with big endian (ABCD) byte order
- Typed: ships
py.typedand passesmypy --strict - Device verification:
async_verify_device()checks that a host answers like a Qube controller (register 77 readable, also when it reads 0 on recent firmware) - mDNS device information: panel software version, controller firmware and UUID from the controller's advertisement
- Monotonic clamping with reset detection for the energy totals: sub-kWh jitter is clamped, while a drop of more than 1 kWh that persists for 3 consecutive reads is accepted as a counter reset (logged as a warning);
clear_monotonic_cache()forgets all baselines
Shared Modbus connection
Pass a ModbusUnit to use a connection someone else owns, for example Home Assistant's shared Modbus connection. connect() and close() then leave the connection alone; host only labels log messages.
from homeassistant.components.modbus import async_get_unit
from modbus_connection import ModbusTcpParams
unit = async_get_unit(hass, entry, ModbusTcpParams(host=host, port=502), 1)
client = QubeClient(host, unit=unit)
Device information over mDNS
The controller advertises a _workstation._tcp mDNS service whose TXT record holds the software version shown on the panel, the controller firmware and a stable UUID. Register 77 (async_get_software_version()) reads 0.0 on recent firmware, so use this for the version instead:
from zeroconf.asyncio import AsyncZeroconf
from python_qube_heatpump import async_get_device_info
aiozc = AsyncZeroconf() # in Home Assistant: zeroconf.async_get_async_instance(hass)
info = await async_get_device_info("192.168.1.100", aiozc)
if info:
print(info.software_version, info.controller_firmware, info.uuid)
The lookup returns None when no record is found within the timeout (default 5 s), for example when mDNS is not forwarded between VLANs. parse_device_info(properties) parses TXT properties you already have, such as those from a zeroconf discovery.
Entity Definitions
The library provides pre-defined entity definitions for all Qube Modbus registers:
from python_qube_heatpump.entities import SENSORS, BINARY_SENSORS, SWITCHES
# Access entity definitions by key
temp_supply = SENSORS["temp_supply"]
print(f"Address: {temp_supply.address}, Unit: {temp_supply.unit}")
Vendor Documentation
The official Modbus register documentation from HR-Energy is available at:
- docs/modbus-lijst-qube-totaal.pdf (included in this repo)
- HR-Energy website
Related Projects
- Qube heat pump - Home Assistant core integration (
hr_energy_qube), available without HACS - qube_heatpump - Home Assistant custom integration (HACS) with extra features, such as a virtual thermostat and a DHW schedule
License
MIT License
Metadata
Release files for python-qube-heatpump 1.18.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_qube_heatpump-1.18.0.tar.gz | 107.2 kB | With provenance | Details for python_qube_heatpump-1.18.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_qube_heatpump-1.18.0-py3-none-any.whl | Python 3 | none | any | Details for python_qube_heatpump-1.18.0-py3-none-any.whl |
Total release size: 133.9 kB
Release files / python_qube_heatpump-1.18.0.tar.gz
| Download URL | python_qube_heatpump-1.18.0.tar.gz |
|---|---|
| Size | 107.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c5ae2e66c3c79d561cc8b39df6a3f788099413d8e4af56a13520f3a50f785fe
|
|
BLAKE2b-256 checksum How to use checksums |
0784b9660e8826a7e26b5dcd8ee8335700e94c2f91e2d990ea6252fde2697072
|
| 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 3, 2026.
Transparency logRelease files / python_qube_heatpump-1.18.0-py3-none-any.whl
| Download URL | python_qube_heatpump-1.18.0-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e237c293c4c64747586b7aec64b7139bf82f36554eab9b6ab0ee90ccd286fc4
|
|
BLAKE2b-256 checksum How to use checksums |
5cbe62fcda2497e75364ee8e18e4b2e02f94e3cde4b3856ee7113d2b8d4e1dac
|
| 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 3, 2026.
Transparency logSecurity for python-qube-heatpump 1.18.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.
Attestation for python_qube_heatpump-1.18.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 3, 2026.
Transparency logA 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.