Zehnder ComfoAir Q350/450/600 with ComfoConnect LAN C - Guide for OpenHAB integration on QNAP NAS (using ComfoAirQ-Homie)

Hi all,

For the Zehnder ComfoAirQ series with a ComfoConnect LAN C Module, there is no binding available for OpenHAB integration. There is another, very long thread where pieces of the integration approach are available but there is no easy guide available that summarizes all steps.

With the help of this great community I managed to integrate our ComfoAirQ with OpenHAB on a QNAP NAS and as I was documenting the whole process for myself, I’d like to share the full approach here. Please note that in my case, everything is running on a QNAP NAS (TS-673) and the installation process below is tailored for this environment.

Overall steps to do:

  • Setup Python on the NAS (if not yet done)
  • Install ComfoAirQ-Homie, dependencies and configs
  • Create and Run the Mosquitto MQTT Broker in the QNAP Container Station
  • Enable the OpenHAB MQTT Binding and create all necessary Things and Items
  • Enable Auto-Run of ComfoAirQ-Homie upon NAS boot with RunLast

1. Setup Python on the NAS
Install the QNAP QPKG “Python3” (or QPython3 from “MyQNAP” repository, but haven’t tested).
Create a folder to hold any config files for your Python scripts, e.g. /share/MyShare/Scripts.

2. Install ComfoAirQ-Homie, dependencies and configs
Install ComfoAirQ-Homie and dependencies as described on GitHub for ComfoAirQ-Homie :

  • Python Wheel: /opt/python3/bin/pip3 install wheel
  • pycomfoconnect: /opt/python3/bin/pip3 install pycomfoconnect

For ComfoAirQ-Homie, I created the folder /share/MyShare/Scripts/comfoairq-homie to hold the necessary config file and then installed the Python script:

  • /opt/python3/bin/pip3 install comfoairq-homie

In the folder /share/MyShare/Scripts/comfoairq-homie, I created the config file comfoairq_homie.yml with the following contents:

  MQTT_PORT: 1883

  COMFOCONNECT_NAME : "ComfoConnect Homie Gateway"
  COMFOCONNECT_UUID : "00000000000000000000000000000006"
  HOMIE_ID              : zehnderq600
  HOMIE_NAME            : ZehnderQ600

When starting ComfoAirQ-Homie, you need to be in this folder or referencing it for the config file, e.g.

cd /share/MyShare/Scripts/comfoairq-homie
/opt/python3/bin/python3 -m comfoairq_homie &

3. Create and Run the Mosquitto MQTT Broker in the QNAP Container Station
Install the eclipse-mosquitto container with the following settings:

  • TCP port mappings 1883->1883 and 9001->9001
  • Persistent folders, e.g.
    • /mosquitto/config → /<your_persistent_folder>/Mosquitto/config
    • /mosquitto/data → /<your_persistent_folder>/Mosquitto/data
    • /mosquitto/log → /<your_persistent_folder>/Mosquitto/log
  • ENV variables (I just set the TZ variable for my timezone, not sure if required, nothing else)

Before spinning up the Container the first time, make sure you have the following config file /mosquitto/config/mosquitto.conf ready in your persistent folder:

persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
allow_anonymous true
connection_messages true
listener 1883

4. Enable the OpenHAB MQTT Binding and create all necessary Things and Items

  • Install the MQTT Binding if not yet done
  • Create the MQTT Broker Thing for Mosquitto with the IP of your NAS IP (e.g., non-secure connection, MQTT Version 5
  • Once the MQTT Broker Thing is online, together with the Mosquitto Broker and the ComfoAirQ-Homie Script running, there are 2 new Things discovered:
    • ZehnderQ600-Gateway
    • ZehnderQ600

Add them as Things, and then start creating the Items.

5. Enable Auto-Run of ComfoAirQ-Homie upon NAS boot with RunLast
The following steps should ensure that ComfoAirQ-Homie is started upon boot of the NAS.

  • Install the QNAP QPKG “RunLast” from the MyQNAP Repository
  • Go to “scripts” directory created by RunLast. All scripts in this directory will be executed upon boot time, once all QPKG packages have been loaded. The command to switch to the directory is:
    cd $(getcfg RunLast Scripts_Path -f /etc/config/qpkg.conf)
  • In this directory, create a script, e.g. “10_Run-ComfoAirQ-Homie.sh” with the following contents:
# Go to ComfoAirQ-Homie directory and start it
cd /share/MyShare/Scripts/comfoairq-homie
/opt/python3/bin/python3 -m comfoairq_homie &

Make sure it’s executable with e.g. chmod 777 (yeah, I know, bad practice …). Talking about “bad practice”, I think my script is bad practice as well but it seems to work. Happy to get suggestions to improve it.

I hope I didn’t forget anything and also hope this summary is helpful for anyone. If you are not shy of using the command line on the NAS then it is not rocket science to get it working.

1 Like

I had to reboot my NAS today and could verify that the above approach with RunLast indeed auto-starts ComfoAirQ-Homie upon a NAS reboot. I adjusted the text above accordingly.