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

Are you using the latest code with HA autodiscovery? Everything works ok for me and no such warnings. Are you using some other climate devices over MQTT? Below is the full config for CA350 climate and the options that are mentioned in your warning messages are not there:

name: CA350 Climate
availability_topic: comfoair/status
payload_available: online
payload_not_available: offline
unique_id: ca350-ca350_climate
device:
  identifiers:
    - ca350
  name: CA350
  manufacturer: Zehnder
  model: ComfoAir 350
temperature_command_topic: comfoair/comforttemp/set
temperature_state_topic: comfoair/comforttemp
current_temperature_topic: comfoair/supplytemp
min_temp: '15'
max_temp: '27'
temp_step: '1'
modes:
  - 'off'
  - fan_only
mode_state_topic: comfoair/ha_climate_mode
mode_command_topic: comfoair/ha_climate_mode/set
fan_modes:
  - 'off'
  - low
  - medium
  - high
fan_mode_state_topic: comfoair/ha_climate_mode/fan
fan_mode_command_topic: comfoair/ha_climate_mode/fan/set
temperature_unit: C
platform: mqtt

How have you configured it in HA? Are you relying on the HA auto discovery or you have your code in configuration.yaml? If the latter you have to check it and adapt to the MQTT Climate integration standards but I would highly recommend to get the latest code from github and rely on the auto discovery which works very well.

can be related to this?
MQTT climate make publishing state independent by jbouwh · Pull Request #63814 · home-assistant/core (github.com)

Probably yes, but this solution does not use this config parameter. Neither it uses the away mode which has been deprecated as well. Unless it is done somehow implicitly that I’m not aware off. Anyway the up to date code which is using the HA auto discovery does not generate those warning messages.

Update: I’ve realized that I’ve had log level set to error. Switched that to warning and I can see those errors as well now. I’ll investigate it but I have a feeling that they’ve put this warning for anyone using MQTT Climate devices regardless if the use those options or not.

I’ve asked this question here:

Update: those warning messages are result of a bug in MQTT integration and will be fixed with this PR: https://github.com/home-assistant/core/pull/67661

1 Like

anyone tried to interface with rs-485 of zehnder display touch, TPC, CAControl or Comfo CronoS ? thanks

Hi,

today I changed the main filters, but pressing reset button doesn’t reset the filter hours
What I have to do?

What is the state of binary_sensor.ca350_filter_status sensor? Based on my experience it only resets if it is already in ON state. And also according to the manual it resets if you press the button and power off - power back on the ventilation unit. I guess it somehow reflects the situation that you perform the maintenance / replace filters with the unit powered off.

Ok, I see
The status is OFF (I guess that it means 0)
I entered the Menu and set it from 0 to 1 to 0

after that, the counter was reset

Hi,
My setup has been working for months without any issues but I recently had to restart my RPi and now I see strange behavior:

  1. I am connecting to my RPi via VNC
  2. Everything looks fine until I start the ca350 script:

sudo /usr/local/share/ca350/bin/ca350

At this point I lose connection to my Pi and need to reboot to get back in again!

I’ve tried this several times and this behavior is consistent.

Any idea how this would be possible or why is it happening? Where to check etc.?

I would suggest that you connect to RPi with SSH only, change the debug parameter to True in config.ini and run the script again. It will be quite talkative so you should see if there is any specific place where it gets stuck.
I would also check if the serial port name has not changed, although it would simply throw an error message rather than freezing entire RPi.

Hi,
Not sure if that was the cause but I changed two things:

  1. I have removed the Serial Console option:
    image

  2. Before starting the script I have executed the script to create the VM

Even so, I noticed that after starting the script the accessibility to the RPi is very slow… so this could just be poor WiFi signal in my case…

However, it started to work now - so hopefully I’m back on track :slight_smile:

Hi adorobis&Tim! Great work and summary, thank you!
I have a problem. I did everything as described, but mqtt (rasbian) doesn’t want to connect to my HA broker. My other devices connect to my HA brokerage without any problems.

admin @ raspberrypi: ~ $ sudo python / usr / local / share / ca350 / bin / ca350

* CA350 MQTT Home Assistant *

13-06-2022 23:56:04 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.
13-06-2022 23:56:14 WARNING: Unable to connect to MQTT broker. Retry in 10 seconds.
13-06-2022 23:56:24 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.
13-06-2022 23:56:34 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.
13-06-2022 23:56:44 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.
13-06-2022 23:56:54 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.
13-06-2022 23:57:04 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.
13-06-2022 23:57:14 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.
13-06-2022 23:57:24 WARNING: Unable to connect to the MQTT broker. Retry in 10 seconds.

my ca350 script:

SerialPort='/dev/ttyUSB0'                   # Serial port CA350 RS232 direct or via USB TTL adapter
RS485_protocol = True # Protocol type
refresh_interval = '10'  # Interval in seconds at which data from RS232 will be polled
enablePcMode = True     # automatically enable PC Mode (disable comfosense)
debug = True

MQTTServer='192.168.1.xx'            # MQTT broker - IP
MQTTPort = '1883'           # MQTT broker - Port
MQTTKeepalive = '45' # MQTT broker - keepalive
MQTTUser='xxxxx'                # MQTT broker - user - default: 0 (disabled/no authentication)
MQTTPassword='xxxxxx'        # MQTT broker - password - default: 0 (disabled/no authentication)

HAEnableAutoDiscoverySensors = True  # Home Assistant send auto discovery for temperatures
HAEnableAutoDiscoveryClimate = True  # Home Assistant send auto discovery for climate

HAAutoDiscoveryDeviceName = 'CA350'            # Home Assistant Device Name

HAAutoDiscoveryDeviceId = 'ca350'     # Home Assistant Unique Id
HAAutoDiscoveryDeviceManufacturer = 'Zehnder'
HAAutoDiscoveryDeviceModel = 'ComfoAir 350 Luxe'

What am I doing wrong?

Thanks

Can you ping your mqtt broker’s IP address from the system where you are running ca350 script?

Hi adorobis,
Yes of course

admin @ raspberrypi::~ $ ping 192.168.1.17
PING 192.168.1.17 (192.168.1.17) 56(84) bytes of data.
64 bytes from 192.168.1.17: icmp_seq=1 ttl=64 time=13.3 ms
64 bytes from 192.168.1.17: icmp_seq=2 ttl=64 time=11.3 ms
64 bytes from 192.168.1.17: icmp_seq=3 ttl=64 time=6.43 ms
64 bytes from 192.168.1.17: icmp_seq=4 ttl=64 time=16.1 ms
^C
--- 192.168.1.17 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 6.425/11.791/16.146/3.547 ms

This is the message after the interruption:

4-06-2022 17:13:31 WARNING: Can't connect to MQTT broker. Retrying in 10 seconds.
^CTraceback (most recent call last):
  File "/usr/local/share/ca350/bin/ca350", line 948, in <module>
    mqttc.connect(MQTTServer, MQTTPort, MQTTKeepalive)
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 912, in connect
    self.connect_async(host, port, keepalive,
  File "/usr/local/lib/python3.9/dist-packages/paho/mqtt/client.py", line 979, in connect_async
    if port <= 0:
TypeError: '<=' not supported between instances of 'str' and 'int'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/share/ca350/bin/ca350", line 952, in <module>
    time.sleep(10)
KeyboardInterrupt

Define port without quotation marks. E.g. MQTTPort=1883 as it should be a number not string. Similarly MQTTKeepAlive. Btw, are you using the latest version of the script? The config should be in a separate file config.ini