comfoconnect-pro-modbus
Read and control Zehnder ComfoAir Q and Flex ventilation units through the ComfoConnect PRO gateway over Modbus TCP or Modbus RTU.
Installation
pip install comfoconnect-pro-modbus "modbus-connection[tmodbus]"
It needs Python 3.12 or later and modbus-connection 4.12.4 or later. The examples use its tmodbus backend, which modbus-connection[tmodbus] installs.
Device setup
- Protocol: select Modbus TCP or Modbus RTU on the gateway's Protocols and services page. The default is none.
- Connection: Modbus TCP uses port 502. For Modbus RTU, the baud rate and parity must match the gateway. The default parity is even with 1 stop bit. With no parity, the gateway uses 2 stop bits.
- Unit ID:
DEFAULT_UNIT_ID(1) by default, settable from 1 to 247 on the gateway. - Firmware: the ventilation unit's firmware must be compatible with the gateway. Otherwise
async_detect()raisesNoVentilationUnitErrorwithINCOMPATIBLE_VERSION. - Supported devices: the ComfoConnect PRO (product number 30006323) with a ComfoAir Q or Flex on ComfoNet. With any other unit, or none,
async_detect()raisesNoVentilationUnitError. - Network: for Modbus RTU, wire the gateway's terminals A and B to the RS-485 adapter.
Usage
The library builds on modbus-connection. You open the connection and pass the library a ModbusUnit. The library never opens or closes the connection itself.
import asyncio
from modbus_connection import ModbusTcpParams
from modbus_connection.tmodbus import ModbusConnection
from comfoconnect_pro_modbus import ComfoConnectPro, VentilationPreset
async def main() -> None:
connection = ModbusConnection(ModbusTcpParams(host="192.168.1.50"))
try:
gateway = await ComfoConnectPro.async_detect(connection.for_unit(1))
await gateway.async_update()
print("Airflow:", gateway.sensors.airflow, "m³/h")
print("Outdoor:", gateway.sensors.outdoor_temperature, "°C")
print("Alarms:", gateway.status.active_alarms)
await gateway.controls.async_write_ventilation_preset(VentilationPreset.HIGH)
finally:
await connection.close()
asyncio.run(main())
Over RS-485, pass ModbusSerialParams instead:
from modbus_connection import ModbusSerialParams
ModbusSerialParams(device="/dev/ttyUSB0", baudrate=19200, parity="E", stopbits=1)
Every value is None until the first update. Each update returns an UpdateReport. report.updated names the components that refreshed. report.failed maps the others to their error, and those keep their previous values. A lost connection raises ModbusConnectionError.
Gotchas
- No identity: the gateway reports no serial number, model or firmware version.
- No off switch: the unit cannot be turned off or put into standby over Modbus.
- Presets and auto mode: a preset write alone overrides auto mode for 2 hours, and
auto_modestaysTrue. The unit then picks the speed again. Writeauto_modeoff first to keep the preset. - Away and boost: both run on top of auto mode or a manual preset.
auto_modestays as it was. While away is on,ventilation_presetreadsAWAY. While a boost runs, it readsHIGH. When either ends, the unit returns to auto mode or the earlier preset. - Temperature profile:
temperature_profileapplies only in the adaptive and fixed modes. The external setpoint applies only in the external setpoint mode. - Comfort temperature: the external setpoint's register reads back the comfort temperature in effect, in every mode.
comfort_temperatureholds it. A write toasync_write_external_setpoint()sets the external setpoint, whichcomfort_temperatureshows only in the external setpoint mode. - Boost time: the boost time's register reads back the time left on a running boost, and 0 without one.
boost_remainingholds it.async_write_boost_time()sets the length of the next boost, which nothing reads back, so write it before each boost. It takes whole seconds from 0 to 65534, or exactlyBOOST_TIME_MAX(86400) for 24 hours. Other values raiseInvalidValueError. Zehnder's app calls the boost the party timer. - External setpoint: takes 0 to 40 °C. The manual gives no range, so the library picks this one.
- CO₂ zones: a zone that reads 0 counts as having no sensor.
- Room sensor: without a room sensor, both room registers read 0.
room_temperatureandroom_humidityare thenNone. - ComfoCool:
comfocoolreadsTrueon a unit without a ComfoCool. It is a setting, not a sign that one is fitted. - Unit-side changes: the unit changes
boost,auto_modeandventilation_presetitself, for example when a boost ends. Pollasync_update_settings()as often as the readings if you show them. - Write retries: every write sets an absolute value, so retrying one is safe. A
ModbusTimeoutErroron a write does not mean the gateway ignored it. - Stalled link: a poll can take several request timeouts before it raises.
- Lost path to the unit: the gateway can lose its Modbus path to the ventilation unit while Zehnder's app still reaches it. It then refuses every read, the connection state included, with Modbus exception 10 (gateway path unavailable).
async_detect()raisesNoVentilationUnitErrorwithstateNone. Saving the gateway's settings, which restarts it, did not bring the path back in testing. Power cycling the ventilation unit did. - Testing: built against the gateway's installation manual, document revision 140. Tested on a ComfoConnect PRO with firmware 1.0.5 and a ComfoAir Q, without a room sensor, CO₂ sensors or a ComfoCool.
API
ComfoConnectPro(unit, *, timeout=None)
The gateway and its ventilation unit, reached through a modbus-connection ModbusUnit.
await async_detect(unit, *, timeout=None): build the device after checking that the gateway reaches a ventilation unit.await async_update_readings(): readstatusandsensors. Returns anUpdateReport.await async_update_settings(): readcontrols. Returns anUpdateReport.await async_update(): read all three in oneUpdateReport.await async_read_raw(): every register and bit the device reads, undecoded.status,sensors,controls: the components below.
status (Status)
connection_state: aConnectionState.OKwhen the gateway reaches a supported unit.Nonefor a code the manual does not list.connection_code: the raw connection state number.is_connected: whetherconnection_stateisOK.active_alarms: the active alarms, asAlarmCodemembers, or plain numbers for codes the manual does not list.active_error_1toactive_error_5: the alarm in each slot, as anAlarmCodeor a plain number, or 0 for an empty slot.active_error(slot): the same, by slot number 1 to 5.error_flag: at least one alarm is active.filter_dirty: the filters must be replaced.standby: the unit is in standby.comfohood: the ComfoHood cooker hood is on.
sensors (Sensors)
airflow: the airflow, in m³/h.room_temperature,extract_temperature,exhaust_temperature,outdoor_temperature,supply_temperature: the air temperatures, in °C.room_humidity,extract_humidity,exhaust_humidity,outdoor_humidity,supply_humidity: the air humidities, in %. The room values areNonewithout a room sensor.co2(zone): the CO₂ level in zone 1 to 8, in ppm.co2_zones: the zones reporting a level, as{zone: ppm}.filter_days_remaining: the time until the filters are due, in days.
controls (Controls)
ventilation_preset: the fan speed, aVentilationPreset.auto_mode: the unit picks the speed itself.boost: the boost is running.boost_remaining: the time left on a running boost, in seconds, or 0 without one.away_function: the away function is on. It is separate fromVentilationPreset.AWAY.comfocool: ComfoCool may cool.temperature_profile: aTemperatureProfile.temperature_profile_mode: aTemperatureProfileMode.comfort_temperature: the comfort temperature in effect, in °C. In the external setpoint mode, the external setpoint.await async_write_ventilation_preset(preset): set the fan speed.await async_write_auto_mode(on): turn auto mode on or off.await async_write_boost(on): start or stop a boost.await async_write_boost_time(seconds): set how long the next boost lasts, up toBOOST_TIME_MAX.await async_write_away_function(on): turn the away function on or off.await async_write_comfocool(on): allow or stop ComfoCool cooling.await async_write_temperature_profile(profile): set the temperature profile.await async_write_temperature_profile_mode(mode): set the temperature profile mode.await async_write_external_setpoint(celsius): set the external setpoint, which the unit follows in the external setpoint mode.await async_reset_errors(): clear the alarms.
Enums
VentilationPreset:AWAY,LOW,MEDIUM,HIGH.TemperatureProfile:NORMAL,COLD,WARM.TemperatureProfileMode:ADAPTIVE,FIXED,EXTERNAL_SETPOINT.ConnectionState:OK,NOT_COMFOAIR_Q,INCOMPATIBLE_VERSION,NO_VENTILATION_UNIT.AlarmCode: the 64 ComfoAir Q alarm codes.enums.pydescribes each one.
Errors
All errors the library raises itself derive from ComfoConnectProError. Transport and device errors come from modbus-connection.
NoVentilationUnitError: raised byasync_detect()when the gateway reports a connection state other thanOK, or has no path to the unit. Itsstateholds theConnectionState, orNonefor a code the manual does not list or no code at all. Itscodeholds the raw number.InvalidValueError: raised by a write before anything is sent, for a value the gateway cannot take: a boost time it cannot store, an external setpoint outside 0 to 40 °C, a value that is not a member of the field's enum, or a switch value that is not abool.active_error()andco2()raise it for a slot or zone out of range. It is also aValueError.ModbusConnectionError(modbus-connection): the link to the gateway is lost.ModbusTimeoutError(modbus-connection): the gateway did not answer in time. An update raises it when the first component it reads times out. A later timeout lands inreport.failed.ModbusExceptionError(modbus-connection): the gateway refused a read or a write. A refused read during an update lands inreport.failed.
The register addresses are in the component modules under src/comfoconnect_pro_modbus, and in chapter 9.3 of the gateway's installation manual.
Troubleshooting
script/query.py reads the device once and prints every value:
uv run script/query.py 192.168.1.50
uv run script/query.py /dev/ttyUSB0 --baudrate 19200 --parity E
Add --raw to include the undecoded registers. A bug report about a wrong value needs them.
If every read fails with "the gateway has no path to the ventilation unit" while Zehnder's app still works, power cycle the ventilation unit. See Lost path to the unit under Gotchas.
The comfoconnect_pro_modbus logger reports at DEBUG the connection state async_detect() found and each component that failed to refresh during an update.
Metadata
Release files for comfoconnect-pro-modbus 0.1.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 |
|---|---|---|---|---|
| comfoconnect_pro_modbus-0.1.0.tar.gz | 52.1 kB | With provenance | Details for comfoconnect_pro_modbus-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| comfoconnect_pro_modbus-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for comfoconnect_pro_modbus-0.1.0-py3-none-any.whl |
Total release size: 72.9 kB
Release files / comfoconnect_pro_modbus-0.1.0.tar.gz
| Download URL | comfoconnect_pro_modbus-0.1.0.tar.gz |
|---|---|
| Size | 52.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33581ee1d95eec5171f7e594a783e77efac8362cd455a046d4cc8e0280c9e783
|
|
BLAKE2b-256 checksum How to use checksums |
0133715cded4308635130fce142e209eb18cabe12bf89cd3f615cb66498208f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 11, 2026.
Transparency logRelease files / comfoconnect_pro_modbus-0.1.0-py3-none-any.whl
| Download URL | comfoconnect_pro_modbus-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b24876f1c8b9ef078c104f2a63d1ab4e643f6a854f0ae67a71e2d898accaf27e
|
|
BLAKE2b-256 checksum How to use checksums |
1ba39785f6d3d9d9796bf584c485a04bbc9e468dbd5a16e299d4904c37f8bbf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 11, 2026.
Transparency logSecurity for comfoconnect-pro-modbus 0.1.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 comfoconnect_pro_modbus-0.1.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 11, 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.