Skip to main content

aiocomfoconnect

aiocomfoconnect is an asyncio Python 3 library for communicating with a Zehnder ComfoAir Q350/450/600 ventilation system. It's the successor of comfoconnect.

The home-assistant-comfoconnect is using this library.

It's compatible with Python 3.10 and higher.

Installation

pip3 install aiocomfoconnect

CLI Usage

$ python -m aiocomfoconnect --help

$ python -m aiocomfoconnect discover

$ python -m aiocomfoconnect register --host 192.168.1.213

$ python -m aiocomfoconnect set-speed away --host 192.168.1.213
$ python -m aiocomfoconnect set-speed low --host 192.168.1.213
$ python -m aiocomfoconnect set-mode auto --host 192.168.1.213
$ python -m aiocomfoconnect set-speed medium --host 192.168.1.213
$ python -m aiocomfoconnect set-speed high --host 192.168.1.213
$ python -m aiocomfoconnect set-boost on --host 192.168.1.213 --timeout 1200

$ python -m aiocomfoconnect set-comfocool auto --host 192.168.1.213
$ python -m aiocomfoconnect set-comfocool off --host 192.168.1.213

$ python -m aiocomfoconnect show-sensors --host 192.168.1.213
$ python -m aiocomfoconnect show-sensor 276 --host 192.168.1.213
$ python -m aiocomfoconnect show-sensor 276 --host 192.168.1.213 -f

$ python -m aiocomfoconnect get-property --host 192.168.1.213 1 1 8 9  # Unit 0x01, SubUnit 0x01, Property 0x08, Type STRING. See PROTOCOL-RMI.md

Available methods

  • async connect(): Connect to the bridge.
  • async disconnect(): Disconnect from the bridge.
  • async register_sensor(sensor): Register a sensor.
  • async deregister_sensor(sensor): Deregister a sensor.
  • async get_mode(): Get the ventilation mode.
  • async set_mode(mode): Set the ventilation mode. (auto / manual)
  • async get_comfocool_mode(): Get Comfocool mode
  • async set_comfocool_mode(): Set Comfocool mode. (auto / off)
  • async get_speed(): Get the ventilation speed.
  • async set_speed(speed): Set the ventilation speed. (away / low / medium / high)
  • async get_bypass(): Get the bypass mode.
  • async set_bypass(mode, timeout=-1): Set the bypass mode. (auto / on / off)
  • async get_balance_mode(): Get the balance mode.
  • async set_balance_mode(mode, timeout=-1): Set the balance mode. (balance / supply only / exhaust only)
  • async get_boost(): Get the boost mode.
  • async set_boost(mode, timeout=-1): Set the boost mode. (boolean)
  • async get_away(): Get the away mode.
  • async set_away(mode, timeout=-1): Set the away mode. (boolean)
  • async get_temperature_profile(): Get the temperature profile.
  • async set_temperature_profile(profile): Set the temperature profile. (warm / normal / cool)
  • async get_sensor_ventmode_temperature_passive(): Get the sensor based ventilation passive temperature control setting.
  • async set_sensor_ventmode_temperature_passive(mode): Set the sensor based ventilation passive temperature control setting. (auto / on / off)
  • async get_sensor_ventmode_humidity_comfort(): Get the sensor based ventilation humidity comfort setting.
  • async set_sensor_ventmode_humidity_comfort(mode): Set the sensor based ventilation humidity comfort setting. (auto / on / off)
  • async get_sensor_ventmode_humidity_protection(): Get the sensor based ventilation humidity protection setting.
  • async set_sensor_ventmode_humidity_protection(mode): Set the sensor based ventilation humidity protection setting. (auto / on / off)

Low-level API

  • async cmd_start_session(): Start a session.
  • async cmd_close_session(): Close a session.
  • async cmd_list_registered_apps(): List registered apps.
  • async cmd_register_app(uuid, device_name, pin): Register an app.
  • async cmd_deregister_app(uuid): Deregister an app.
  • async cmd_version_request(): Request the bridge's version.
  • async cmd_time_request(): Request the bridge's time.
  • async cmd_node_request(): Retrigger the discovery of the nodes on the ComfoNet bus.
  • async cmd_rmi_request(message, node_id): Send a RMI request. When no node_id is given, the discovered ventilation unit is used, and a VentilationUnitNotFoundException is raised when the bridge hasn't announced one.
  • async cmd_rpdo_request(pdid, type, zone, timeout): Send a RPDO request.
  • async cmd_keepalive(): Send a keepalive message.

Examples

Discovery of ComfoConnect LAN C Bridges

import asyncio

from aiocomfoconnect import discover_bridges


async def main():
    """ ComfoConnect LAN C Bridge discovery example."""

    # Discover all ComfoConnect LAN C Bridges on the subnet.
    bridges = await discover_bridges()
    print(bridges)


if __name__ == "__main__":
    asyncio.run(main())

Basic Example

import asyncio

from aiocomfoconnect import ComfoConnect
from aiocomfoconnect.const import VentilationSpeed
from aiocomfoconnect.sensors import SENSORS


async def main(local_uuid, host, uuid):
    """ Basic example."""

    def sensor_callback(sensor, value):
        """ Print sensor updates. """
        print(f"{sensor.name} = {value}")

    # Connect to the Bridge
    comfoconnect = ComfoConnect(host, uuid, sensor_callback=sensor_callback)
    await comfoconnect.connect(local_uuid)

    # Register all sensors
    for key in SENSORS:
        await comfoconnect.register_sensor(SENSORS[key])

    # Set speed to LOW
    await comfoconnect.set_speed(VentilationSpeed.LOW)

    # Wait 2 minutes so we can see some sensor updates
    await asyncio.sleep(120)

    # Disconnect from the bridge
    await comfoconnect.disconnect()


if __name__ == "__main__":
    asyncio.run(main(local_uuid='00000000000000000000000000001337', host='192.168.1.20', uuid='00000000000000000000000000000055'))  # Replace with your bridge's IP and UUID

Development Notes

Protocol Documentation

Decode network traffic

You can use the scripts/decode_pcap.py file to decode network traffic between the Mobile App and the ComfoConnect LAN C. Make sure that the first TCP session in the capture is the connection between the bridge and the app. It's therefore recommended to start the capture before you open the app.

$ sudo tcpdump -i any -s 0 -w /tmp/capture.pcap tcp and port 56747
$ python3 script/decode_pcap.py /tmp/capture.pcap

Generate zehnder_pb2.py file

python3 -m pip install grpcio-tools==1.73.0
python3 -m grpc_tools.protoc -Iprotobuf --python_out=aiocomfoconnect/protobuf protobuf/*.proto

Docker

You can build a Docker image to make it easier to develop and experiment on your local machine. You can use the docker build -t aiocomfoconnect . or the shortcut make build command to create a docker image.

Next, you can run this image by running docker run aiocomfoconnect. Any args from aiocomfoconnect can be passed into this command, just like the python3 -m aiocomfoconnect command.

Interesting 3th party repositories

Download files

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

Source Distribution

aiocomfoconnect-0.2.0.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

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

aiocomfoconnect-0.2.0-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

Details for the file aiocomfoconnect-0.2.0.tar.gz.

File metadata

  • Download URL: aiocomfoconnect-0.2.0.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiocomfoconnect-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9ac0cc5e0043f11dfc3225c8a03c371aa1245e1eb54efe7ec24d4fc0e8deca0f
MD5 058534d341e63be1e7bb035239cc94a2
BLAKE2b-256 417a2be8c0b5fcac9f72442634c93f76b8f4d8e5ddd8cab5644533b32f4c457f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiocomfoconnect-0.2.0.tar.gz:

Publisher: release.yml on michaelarnauts/aiocomfoconnect

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

File details

Details for the file aiocomfoconnect-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aiocomfoconnect-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fca08159c7043b5433d6fceec05a28579f9a096b83b4200b289ea5da12f730d
MD5 de98c751ad4578de0edec4097ee46ae6
BLAKE2b-256 3cf3516818d85e203f0315df30c205f3066a36c80edaddac493ab3d367517cd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiocomfoconnect-0.2.0-py3-none-any.whl:

Publisher: release.yml on michaelarnauts/aiocomfoconnect

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 Sentry Error logging StatusPage Status page