Mqtt integration: [Errno 104] Connection reset by peer

Hi there, whenever I try to configure the mqtt integration I am stuck with this error:

Logger: paho.mqtt.client
Source: /usr/local/lib/python3.12/site-packages/paho/mqtt/client.py:2529
First occurred: September 12, 2024 at 10:16:04 PM (6 occurrences)
Last logged: 12:25:13 PM
failed to receive on socket: [Errno 104] Connection reset by peer

This is the configuration that works outside of HA:

It is a TLS encrypted connection to mqtt://IP:1883 without cert validation.

From HA terminal I can verify that the port can be reached. So it seems to be something regarding the parameter mapping from the integration UI inputs to the call to the server…

I tried with and without mqtt:// prefex, protocol versions, nothing fits. And unfortunately after each try all the input params are gone so I need to re-input them each and every time from scratch. A downside of not being able to set the config via yaml… :wink:

This is what mosquitto instance is logging:

1726339473: New connection from 10.xxx.xxx.126:41848 on port 1883.
1726339473: OpenSSL Error[0]: error:0A000126:SSL routines::unexpected eof while reading
1726339473: Client <unknown> disconnected: Protocol error.

Okay, solution as follows (mqtt integration: setting TLS settings only if client certificate is set? · Issue #125930 · home-assistant/core · GitHub)

If a self signed cert is used one MUST provide a ca file because only then the TLS insecure option will be used.