Client <unknown> closed its connection

I’m a complete noob to HASS. Got around to installing mqtt via mosquitto yesterday, but I wasn’t able to get past the configuration. Whenever I click configure and then submit, I get a message saying “Failed to connect”. I checked the logs and they only show:
2023-10-24 19:50:51: New connection from 172.30.32.2:50774 on port 1883.
2023-10-24 19:50:51: Client closed its connection.
I am running HAOS directly on an old intel nuc using ethernet if that helps.
Thanks for any help. I am new to smart homes in general.
I’ll copy and paste the logs I see below:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/mosquitto.sh
[19:42:49] INFO: SSL is not enabled
cont-init: info: /etc/cont-init.d/mosquitto.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun mosquitto (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
[19:42:49] INFO: Starting NGINX for authentication handling…
[19:42:49] INFO: Starting mosquitto MQTT broker…
2023-10-24 19:42:49: mosquitto version 2.0.17 starting
2023-10-24 19:42:49: Config loaded from /etc/mosquitto/mosquitto.conf.
2023-10-24 19:42:49: Loading plugin: /usr/share/mosquitto/go-auth.so
2023-10-24 19:42:49: Warning: Mosquitto should not be run as root/administrator.
2023-10-24 19:42:49: ├── Username/password checking enabled.
2023-10-24 19:42:49: ├── TLS-PSK checking enabled.
2023-10-24 19:42:49: └── Extended authentication not enabled.
2023-10-24 19:42:49: Opening ipv4 listen socket on port 1883.
2023-10-24 19:42:49: Opening ipv6 listen socket on port 1883.
2023-10-24 19:42:49: Opening websockets listen socket on port 1884.
2023-10-24 19:42:49: mosquitto version 2.0.17 running
2023-10-24 19:42:49: New connection from 127.0.0.1:40984 on port 1883.
2023-10-24 19:42:49: Client disconnected due to protocol error.
s6-rc: info: service legacy-services successfully started
[19:42:50] INFO: Successfully send discovery information to Home Assistant.
[19:42:50] INFO: Successfully send service information to the Supervisor.
2023-10-24 19:42:51: New connection from 172.30.32.2:43122 on port 1883.
2023-10-24 19:42:51: Client closed its connection.
2023-10-24 19:44:51: New connection from 172.30.32.2:35328 on port 1883.
2023-10-24 19:44:51: Client closed its connection.
2023-10-24 19:46:51: New connection from 172.30.32.2:34266 on port 1883.
2023-10-24 19:46:51: Client closed its connection.
2023-10-24 19:48:51: New connection from 172.30.32.2:38716 on port 1883.
2023-10-24 19:48:51: Client closed its connection.
2023-10-24 19:50:51: New connection from 172.30.32.2:50774 on port 1883.
2023-10-24 19:50:51: Client closed its connection.

:clap: Welcome!

I don’t use HASSOS, but I believe you need to set an mqtt user/password for it to work. This should help…

I literally just posted another question with the same topic. Perhaps what I found will help you…

1 Like

followed that also and setup another user, then added that user to mqtt config.
the error message went away!!!

I still don’t understand. I have 1 real client; ‘frigate’(user created in HomeAssistant) and see another client ‘homeassistant’ that both perfectly connect. ‘homeassistant’ user is probably Homeassistant itself. But for what.?
Still have this client ‘unknown’ that keeps connecting and disconnecting every minute or so with ip 172.30.32.2.
I have a Frigate on my synology NAS in Docker container and Homeassistant on raspberry pi. I installed Mosquitto broker as addon on Homeassistant on the raspberry PI.
I’m not aware of any other usage/user of MQTT broker on Homeassistant. The only reason for me is for Frigate.

Blockquote
[21:44:44] INFO: Starting NGINX for authentication handling…
[21:44:45] INFO: Starting mosquitto MQTT broker…
2024-12-11 21:44:45: Warning: Mosquitto should not be run as root/administrator.
2024-12-11 21:44:45: mosquitto version 2.0.18 starting
2024-12-11 21:44:45: Config loaded from /etc/mosquitto/mosquitto.conf.
2024-12-11 21:44:45: Loading plugin: /usr/share/mosquitto/go-auth.so
2024-12-11 21:44:45: ├── Username/password checking enabled.
2024-12-11 21:44:45: ├── TLS-PSK checking enabled.
2024-12-11 21:44:45: └── Extended authentication not enabled.
2024-12-11 21:44:45: Opening ipv4 listen socket on port 1883.
2024-12-11 21:44:45: Opening ipv6 listen socket on port 1883.
2024-12-11 21:44:45: Opening websockets listen socket on port 1884.
2024-12-11 21:44:45: mosquitto version 2.0.18 running
2024-12-11 21:44:47: New connection from ::1:51330 on port 1883.
2024-12-11 21:44:47: Client <unknown> disconnected due to protocol error.
2024-12-11 21:44:47: New connection from 172.30.32.1:50593 on port 1883.
2024-12-11 21:44:47: New client connected from 172.30.32.1:50593 as 2AtxxxxxxxxxCllFzB (p2, c1, k60, u’homeassistant’).
2024-12-11 21:44:49: New connection from 172.30.32.2:41990 on port 1883.
2024-12-11 21:44:49: Client <unknown> closed its connection.
[21:44:51] INFO: Successfully send discovery information to Home Assistant.
[21:44:53] INFO: Successfully send service information to the Supervisor.
2024-12-11 21:44:54: New connection from 10.10.132.22:38075 on port 1883.
2024-12-11 21:44:54: New client connected from 10.10.132.22:38075 as frigate (p2, c1, k60, u’frigate’).
2024-12-11 21:46:49: New connection from 172.30.32.2:43150 on port 1883.
2024-12-11 21:46:49: Client <unknown> closed its connection.
2024-12-11 21:48:49: New connection from 172.30.32.2:60822 on port 1883.
2024-12-11 21:48:49: Client <unknown> closed its connection.

By the help from another thread in this community for which I can’t find the link anymore, I found the root cause(not the solution).
By disabling the watchdog slider on the Mosquitto MQTT add-on card, repeating loggings for 172.30.32.2 disappear.
Still no answer while with the watchdog enabled there is 1 logging with successful connection from 172.30.32.1 for user ‘homeassistant’ and a repeating connect-disconnect from 172.30.32.2 for user ‘’.???

1 Like