Skip to main content

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 ModbusUnit from 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() and get_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(), and write_setpoint() within each register's min_value/max_value
  • SG Ready: get_sg_ready_mode() / set_sg_ready_mode() with the modes off, block, plus and max
  • Unified status: QubeState.status combines the status code with the anti-legionella request (resolve_status())
  • FLOAT32 decoding with big endian (ABCD) byte order
  • Typed: ships py.typed and passes mypy --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:

  • 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.19.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 python-qube-heatpump 1.19.0
File Size Uploaded Provenance Actions
python_qube_heatpump-1.19.0.tar.gz 107.6 kB With provenance Details for python_qube_heatpump-1.19.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-qube-heatpump 1.19.0
File Interpreter ABI Platform Actions
python_qube_heatpump-1.19.0-py3-none-any.whl Python 3 none any Details for python_qube_heatpump-1.19.0-py3-none-any.whl

Total release size: 134.5 kB

Release files / python_qube_heatpump-1.19.0.tar.gz

Download URL python_qube_heatpump-1.19.0.tar.gz
Size 107.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f3ee9ac66913e8b670605a3c55925c6e86396fef2d5bbc01a466b80edd137a83
BLAKE2b-256 checksum
How to use checksums
81e176ba099f2fd4a0923ee97fa812513191cbba7c093491d73e299a924b4d84
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 20, 2026.

Transparency log

Release files / python_qube_heatpump-1.19.0-py3-none-any.whl

Download URL python_qube_heatpump-1.19.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
249b40f58038ee9271ae8017e96273373b86fe380fdf7cc9214700d9c6f36f9e
BLAKE2b-256 checksum
How to use checksums
385c5fe9f507185e7404ec26deb85c975070f7e0db7cea29d1449ffe71a82c03
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 20, 2026.

Transparency log

Security for python-qube-heatpump 1.19.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 python_qube_heatpump-1.19.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 20, 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.

Release history Release notifications | RSS feed

This release

1.19.0 This release

2 release files Full provenance

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