Mqtt keeps disconnecting (after succesful connection)

Hi,

I am using Beebotte mqtt broker and it used to work fine until I upgraded to the latest version of hassio. I The broker doesnt provide any username/password but only a token which in my configuration I had:

mqtt:
  broker: mqtt.beebotte.com
  username: "token:token_XXXXX"

Now I get my logs are flooded with this ERROR message:

2020-XX-XX XX:XX:XX WARNING (Thread-5) [homeassistant.components.mqtt] Disconnected from MQTT server mqtt.beebotte.com:1883 (1)

Can anyone help on this matter?

Thanks

Well some more investigation…

It seems that I am connected but it disconnects after a while, log says:

2020-10-19 21:36:27 INFO (Thread-5) [homeassistant.components.mqtt] Connected to MQTT server mqtt.beebotte.com:1883 (0)
2020-10-19 21:36:27 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to ifttt/ga, mid: 123
2020-10-19 21:36:29 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on homeassistant/status: 'online', mid: 124
2020-10-19 21:36:30 WARNING (Thread-5) [homeassistant.components.mqtt] Disconnected from MQTT server mqtt.beebotte.com:1883 (1)

Is it possible that “Transmitting message on homeassistant/status: ‘online’” breaks the connection with themqtt server?

1 Like

Same issue on last HA
Its happens at night, and may randomly disconnect totaly

Having exactly the same issue since V0.117.
Config:

mqtt:
  broker: 192.168.178.45
  client_id: ha
# mqtt discovery
#  discovery: true
#  discovery_prefix: ha

(Does not matter whether discovery is on or off.)

Now lots of errors in homeassistant.log like:

2020-11-04 20:47:31 WARNING (Thread-5) [homeassistant.components.mqtt] Disconnected from MQTT server 192.168.178.45:1883 (1)

This is my local broker on the same Pi3. (I am using the HA core install).
Mosquitto.log shows:

1604519147: New client connected from 192.168.178.45 as ha (c1, k60).
1604519148: New connection from 192.168.178.45 on port 1883.
1604519148: Client ha already connected, closing old connection.
1604519148: Socket error on client ha, disconnecting.
1604519148: New client connected from 192.168.178.45 as ha (c1, k60).
1604519149: New connection from 192.168.178.45 on port 1883.
1604519149: Client ha already connected, closing old connection.

endlessly…

Ok found a solution for me:
disable the client id, so the config is now the most simple possible:

mqtt:
  broker: 192.168.178.45

This is with HA V0.117.2 core installation and my own mosquitto v3.1 installation (has not been touched for some time)
I guess this is bug for V0.117 as the cliend_id was used before with no problem?

I have the same problem with Home Assistant OS, Mosquitto broker on RPi3 starting from v. 0.117. There is auto-configured MQTT integration

HA log:
2020-11-24 11:43:09 WARNING (Thread-5) [homeassistant.components.mqtt] Disconnected from MQTT server core-mosquitto.local.hass.io:1883 (1)
2020-11-24 12:24:04 WARNING (Thread-5) [homeassistant.components.mqtt] Disconnected from MQTT server core-mosquitto.local.hass.io:1883 (1)

Mosquitto add-on log:
1606207385: Client 5JoqTIwffOAuTj5IJ45ClB has exceeded timeout, disconnecting.
1606207390: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1606207392: New client connected from 172.30.32.1 as 5JoqTIwffOAuTj5IJ45ClB (p2, c1, k60, u’homeassistant’).
1606208257: Saving in-memory database to /data/mosquitto.db.
1606209842: Client 5JoqTIwffOAuTj5IJ45ClB has exceeded timeout, disconnecting.
1606209845: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1606209847: New client connected from 172.30.32.1 as 5JoqTIwffOAuTj5IJ45ClB (p2, c1, k60, u’homeassistant’).