Open unixpapers opened 8 years ago
For your info - from PubSubClient.h:
// Possible values for client.state()
#define MQTT_CONNECTION_TIMEOUT -4
#define MQTT_CONNECTION_LOST -3
#define MQTT_CONNECT_FAILED -2
#define MQTT_DISCONNECTED -1
#define MQTT_CONNECTED 0
#define MQTT_CONNECT_BAD_PROTOCOL 1
#define MQTT_CONNECT_BAD_CLIENT_ID 2
#define MQTT_CONNECT_UNAVAILABLE 3
#define MQTT_CONNECT_BAD_CREDENTIALS 4
#define MQTT_CONNECT_UNAUTHORIZED 5
So your error seems to be that your connection has failed. This might be because of a connection problem (worth checking), or that the broker you are trying to connect to is on a different port/path.
I had a similar problem connecting to the Adafruit broker, but it turns out I wasn't building the 'topic' (path) correctly. So it was acting like there was a problem with the connection (presumably was returning http 400/300 type errors)
Hi!
Version: Arduino IDE 1.6.6 (and test 1.6.5), Arduino ESP8266 (2.0.0) when try to connect error -2. Try use anonymous too. Used tcpdump on Mosquitto server packages have. Have any ideas?
WiFi connected IP address: 192.168.1.3 Attempting MQTT connection...failed, rc=-2 try again in 5 seconds Attempting MQTT connection...failed, rc=-2 try again in 5 seconds