I am having a problem with a Tasmotized Sonoff not connecting to the MQTT broker, and would appreciate advice how to debug this.
The MQTT broker is Mosquitto running on a Raspberry Pi; I can successfully connect to it from various MQTT clients such as MQTT.fx, MQTT Explorer, and can subscribe and publish to it. I also have OpenHAB client Things connected to it, and they can also publish and subscribe. (So in other words, I have one MQTT broker and four different clients all singing from the same song book).
But then I also have a Tasmotized Sonoff TH16 which does NOT connect to the MQTT broker (see console log below).
16:44:43 MQT: Attempting connection...
16:44:47 MQT: Connect failed to 191.168.1.131:1883, rc -2. Retry in 10 sec
All clients (including the Sonoff) are set up identically as follows..
Host: 191.168.1.131 // NOTE: IP address rather than Host Name to avoid DNS issues
Port: 1883
User: myName
Pwd: myPassword
The Sonoff is physically connected via 2.4GHz wi-fi, and the other clients are on Ethernet. All clients are on the same IP sub-net, and all clients received their IP addresses via DHCP (auto) from the same router. I can connect to the Sonoff via HTTP on its web server, so there is active routing between the Ethernet and Wi-Fi parts of the LAN (I even connected Wireshark and can see this traffic). The router is a Ubiquiti EdgeMax EdgeRouter Lite, and the Wi-Fi is via Ubiquiti UNIFI wireless access points.
I know that "rc -2" means "failed to connect". But why??