Zehnder ComfoAir CA350 integration via serial connection (RS232) and MQTT

@adorobis, oh, sorry i didn’t get that when I read it. Question, the cable you suggested is using all of the pin? Or only the 3 required?

If you connect to the RS232 port in the comfoair with a ready to use cable it will have all pins connected. I’m using just a standard RS232 cable - on the computer side I have just regular RS232 port.
If you connect to the RJ45 or the screwed connectors you have to connect only the 3 pins as per the mapping instruction.

HI,

my first attempt failed :(, I need some support

When i start the component on the PI i see this

13-02-2021 08:19:16 WARNING: Changing the RS232 mode went wrong
13-02-2021 08:19:16 INFO: Home Assistant MQTT Autodiscovery Topic Set: homeassistant/fan/ca350_fan/config
13-02-2021 08:19:16 INFO: Home Assistant MQTT Autodiscovery Topic Set: homeassistant/sensor/ca350_[nametemp]/config
13-02-2021 08:19:17 INFO: Successfull subscribed to the comfoair/on/set topic
13-02-2021 08:19:17 INFO: Successfull subscribed to the comfoair/speed/set topic
13-02-2021 08:19:17 INFO: Successfull subscribed to the comfoair/comforttemp/set topic
13-02-2021 08:19:17 INFO: Successfull subscribed to the comfoair/ha_climate_mode/set topic
13-02-2021 08:19:17 INFO: Successfull subscribed to the comfoair/ha_climate_mode/fan/set topic
13-02-2021 08:19:18 WARNING: get_temp function could not get serial data
13-02-2021 08:19:20 WARNING: function get_fan_status could not get serial data
13-02-2021 08:19:22 WARNING: get_ventilation_status function could not get serial data

on the Home assistant side i see:

1613204354: New connection from 192.168.1.21 on port 1883.
[INFO] found mqtt_user on local database
1613204354: New client connected from 192.168.1.21 as CA350 (p2, c1, k45, u mqtt_user ).
1613204401: New connection from 192.168.1.20 on port 1883.
[WARN] Not found mqtt_user on local database
1613204402: Socket error on client , disconnecting.
1613204459: New connection from 192.168.1.20 on port 1883.
1613204459: Socket error on client , disconnecting.
1613204474: Saving in-memory database to /data/mosquitto.db.
1613204514: New connection from 192.168.1.20 on port 1883.
1613204689: Socket error on client , disconnecting.
1613204741: Client CA350 has exceeded timeout, disconnecting.
1613204755: New connection from 192.168.1.20 on port 1883.

This is my config.ini

do I have to set RS485 to TRUE?

GreenCable --> Rj45 pin 2
BlueCable --> Rj45 pin 3
BlackCable --> Rj45 pin 8

this is my ComfoAir board

Do i have to disconnect the LCD?

Any suggetions?
Regards

HI,

i have another question
i don’t see the picture in the CARD

this is the folder

do i miss something?

If it is connected via RS232 - yes, only one device can be connected at a time.

Not sure what’s happening to your connection to the MQTT - did you provide proper user id and password? Or it does not require it? Check that first. And you might want to enable the debug mode in the script to see more messages about what is actually happening.

I think you have to swap TX/RX: TX on USB adapter should connect to RX on the CA350 and the other way round.

@adorobis, thank you. I switched the cable and I worked.


but after the reboot i’m still in the same issues

1 Like

@adorobis, thank you. i found the error with MQTT, too strong password and too long
after i change it with a smaller one it works

1 Like

You will see those warnings regularly the serial implementation on the CA units is not very reliable, so the script is repeating control commands until successful.

@adorobis, thank you. So, how I can validate that everything works? I mean, because it fails the data are not updated, how I can get if the “failure” is related to the serial reliability and not on the connection (eg. i switched the cables)

Regards

Good question, I have no clue :slight_smile: Maybe a good idea for improvement in the code to capture cases when even retries fail and raise an exception or something like that.

1 Like

I see the entities and I can add the values with the standard card

but i can’t load it in the custom card

ideas?

Check the climate.ca350_climate entity, you have to enable it in the .ini file, it is disabled by default:

HAEnableAutoDiscoveryClimate=True

Blockquote
Check the climate.ca350_climate entity, you have to enable it in the .ini file, it is disabled by default:
HAEnableAutoDiscoveryClimate=True

AWSOME!!! it works

it sounds it doesn’t work anymore; the data are never refreshed
it seems that the serial is properly initialized

and I also see that the USB I’m using has a led to show when TX or RX happens

I see TX blinking, but no the RX

Dear all,
thanks for this very interesting post. I followed this tutorial to setup my installation using the embedded serial port of a raspberry 3.
The mqtt actually works, but it seems that serial data being received through the port are not in the correct format to be interpreted by the python program since “sensors” are populated within HA with dummy data.

It’s a week now I’m trying to figure out what the problem is, but my knowledge in this field is hugely limited and I’ll appreciate the community help…

This is the message I receive from there python program while running: I guess “expected return not found” is the problem…

Mar 18 13:51:26 DietPi python3[7794]: 18-03-2021 12:51:21 WARNING: Expected return not found
Mar 18 13:51:26 DietPi python3[7794]: 18-03-2021 12:51:21 WARNING: get_filter_status function could not get serial data
Mar 18 13:51:26 DietPi python3[7794]: 18-03-2021 12:51:23 WARNING: Expected return not found
Mar 18 13:51:26 DietPi python3[7794]: 18-03-2021 12:51:23 WARNING: function get_bypass_status could not get serial data
Mar 18 13:51:26 DietPi python3[7794]: 18-03-2021 12:51:25 WARNING: Expected return not found
Mar 18 13:52:59 DietPi systemd[1]: Stopping comfoair2mqtt...
Mar 18 13:52:59 DietPi python3[7794]: 18-03-2021 12:51:25 WARNING: function get_preheating_status could not get serial data

Attached there are some transcripts of the output I’m getting from the serial port: is there anyone able to understand if I’m having a problem with my Comfoair (11yrs old), or there is a solution?

Any help would be much appreciated.
Thanks, Simone!

Screenshot_20210319-062525|281x500

Hello @bassguitarist,

Then i guess that you are not using any RS232 adaptor, so 'im not sure that your setup is supported.
As a reminder, here is the setup used:
image

Thanks very much for your answer.

I believe that the series of connectors shown by the scheme only add a serial port (eg /dev/ttyUSB0), while data remain the same…

In effect, another try I did was using the shown configuration on a regular Ubuntu installation, using a ttl/usb converter with CH340 chip. Data received match with data sniffed through rasp /dev/ttyS0, but still not interpreted by the python script.

[edit]
I’ll give a try with a FTDI-RS232 connector, since I’m now figuring the difference between the UART interface built-in the raspi and the RS-232 protocol…

I’ll keep you informed, so that anyone trying to replicate what I did may benefit of my trials…
:sweat_smile:

I’m also using an embedded RS232 port on my motherboard, so this is for sure supported. Check if swapping TX/RX cables would not solve your problem, this is the most typical mistake in wiring serial ports. Another problem you might face is that you can only have one RS232 device connected to the Comfoair unit so disconnect your control panel first.

Hello All.
Thank you for all your great work and support so far.
I have successfully managed to install the CA35 integration.
Would it be possible to set the fans to maximum level based on humidity sensors level (e.g humidity > 60% triggers the ventilation to maximum levels and humidity <50% set ventilation back to auto mode?
I have got Xiaomi TH sensors installed in bathrooms.
Thank you in advance.