MQTT devices stop working


I have 2 light dimmers setup over MQTT ( ESP32 and MOSFET to switch and dim LEDs).
Also, I have temperature sensor with ESP8266 that reports data over MQTT.
All setups uses my own code I wrote in ArduinoIDE and upload to devices.
Everything worked flawlessly for almost half year.
Yesterday all stooped working.
Other non MQTT integrations seems to work fine even though I don’t have much of integrations.
But TV, phones, RaspPi statistic it works ok.

This is example of my mqtt light in HA:

- platform: mqtt
  name: "Kitchen"
  availability_topic: "/light/kitchen/availability" 
  state_topic: "/light/kitchen/state"
  command_topic: "/light/kitchen/state/set"
  brightness_state_topic: "/light/kitchen/brightness"
  brightness_command_topic: "/light/kitchen/brightness/set"
  payload_on: "ON"
  payload_off: "OFF"

Arduino code uses PubSubClient library, #include "PubSubClient.h"
I use static IP address for those devices like so:
// WiFi Static IP example

IPAddress staticIP(192,168,0,X);
IPAddress gateway(192,168,0,X);
IPAddress subnet(255,255,255,0);
IPAddress dns1(X,X,X,X);
IPAddress dns2(X,X,X,X);

I try to ping device from my PC and it worked ok.
Than I took one of ESP32 boards and connect to arduinoIDE serial monitor for debugging.
I didn’t noticed any problems there.
Board connected to MQTT server and subscribed on topics, but when I would try to turn on light through HA light button device didn’t receive MQTT message for that.

Next, I try to publish and listen topics manually in HA Mosquitto, btw, I am using Mosquitto broker add on in HA.
But I can listen topics on which I subscribe properly there.

I would appreciate some help with troubleshooting of this.
Since I currently need to figgure out how should I troubleshoot this further.
I don’t think that there is any problem with HW, i.e. devices itself, since it is not likely that all 3 devices stop working at the same time.

Yesterday mosquitto broker got an update to 6.0x.
Coincidence maybe?



  • Fix loading custom mosquitto configuration


  • Support for anonymous logins has been removed
  • Replaced Home Assistant authentication handling
  • Merged local account handling with authentication plugin
  • Add watchdog endpoint for health monitoring
  • Updated mosquitto to 1.6.12
  • Updated mosquitto auth plugin to 0.1.5
  • Migrate add-on layout to S6 Overlay
  • Migrate all script to use Bashio
  • Update base image to Alpine Linux 3.13
  • Add port descriptions

Thanks for this info, I would suspect that this is somehow related with my problem.
Seems like I am not the only one:

This is the important change:

Are you using anonymous logins?

Not sure about that to be honest.
This is configuration in Mosquitto add on:

logins: []

Logins is not set.
However, I do have created mqtt user and pwd in HA and my code on ESP devices actually uses username and pwd like so:

const char* MQTT_SERVER = "x.x.x.x";
const int   MQTT_PORT = xxxx;
const char* MQTT_USERNAME = "xxxx";
const char* MQTT_PASSWORD = "xxxx";
const char* MQTT_CLIENT_NAME = "/xxxxx/xxxxx/xxxxx";

As long as that matches the user and password in your devices you should be ok.

Someone on Discord had a similar issue today. Did you try removing the integration, restarting and letting HA rediscover it (or add it back manually?)

1 Like

I try to uninstall MQTT broker, remove and add MQTT integration but it did not help.
I can see in MQTT broker log following trace:
Warning: Mosquitto should not be run as root/administrator.
My MQTT broker have all setting to default except I created HA user for MQTT and reconfigure username and pwd.

One more thing to add from MQTT broker logs is that I can normally see traces which indicates that my ESP devices are connected on MQTT broker like so:
1621508108: New client connected from as /light/bedroom/desk/ (p2, c1, k15, u'my_user_name').
But the messages from devices and towards devices doesn’t seems to work.

The administrator warning is usual. Assume your devices use the same user/password?

Yes, all 3 devices uses same mqtt user and pass.

Have you used say MQTT Explorer to see if the broker is seeing the messages?

No, did not. I’ll try that. Thnx, let you know findings.

I try to check status on MQTT Explorer, I am first time using it, but as far I can see there is no messages received from devices. Only messages I sent manually appear.
But from broker status seems like clients were actually connected


I disconnect device/client and plug it again and noticed that i changed status to connected.

Does anyone uses Nick O’Leary “PubSubClient.h” library with Arduino sketch and latest Mosquitto broker 6.0.1 add on in HA?

1 Like