MQTT with SSL/TLS and a self-signed certificate

Hi there,

I’m trying to setup a MQTT connection between Home Assistant and my MQTT broker over SSL/TLS. I’m using a self-signed certificate, I generated with OpenSSL 1.1.1d. I confirmed that my broker is setup correctly with a MQTT Dashboard app on my phone. Home Assistant cannot connect to it due to the self-signed certificate. I keep getting this error:

Failed to connect due to exception: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)

From the research I conducted I know that you can pass on verify=False in Python to omit that error. Is there any way I can set it up in configuration.yaml?

I have not experimented with MQTT and certificates but usually you need to distribute the certificate from the server to let clients verify the server against the pre-shared certificate when connecting.

The links below seems to show a “tls_insecure” that you can set to true and also how to specify a certificate file or put “auto” as cert.

I have the tls_insecure set to true and I also provided the server’s certificate. The thing is that Home Assistant refuses to use it due to it being self-signed. You would think, that they would add an option in Home Assistant to allow self-signed certificates, especially knowing that other components like camera have verify_tls option.

I had a SD card failure, so I had to reinstall home-assistant on a new system and after copying ca certificate as well as server certificate and key to homeassistant directory and configurating it once again it started working.