ESP8266MQTTMesh icon indicating copy to clipboard operation
ESP8266MQTTMesh copied to clipboard

Returns the current state of the client

Open timurufa86 opened this issue 4 years ago • 1 comments

Make sure you have the latest version of ESP8266MQTTMesh before reporting an issue.

Please Provide the following information:

  • ESP8266MQTTMesh version: last
  • AsyncMQTTClient version: laST
  • ESPAsyncTCP version: LAST
  • ESP8266 Core version: LAST

If you are you using platformio or Arduino, which one?

Description of problem:

int state () Returns the current state of the client. If a connection attempt fails, this can be used to get more information about the failure.

Returns int - the client state, which can take the following values (constants defined in PubSubClient.h): -4 : MQTT_CONNECTION_TIMEOUT - the server didn't respond within the keepalive time -3 : MQTT_CONNECTION_LOST - the network connection was broken -2 : MQTT_CONNECT_FAILED - the network connection failed -1 : MQTT_DISCONNECTED - the client is disconnected cleanly 0 : MQTT_CONNECTED - the client is connected 1 : MQTT_CONNECT_BAD_PROTOCOL - the server doesn't support the requested version of MQTT 2 : MQTT_CONNECT_BAD_CLIENT_ID - the server rejected the client identifier 3 : MQTT_CONNECT_UNAVAILABLE - the server was unable to accept the connection 4 : MQTT_CONNECT_BAD_CREDENTIALS - the username/password were rejected 5 : MQTT_CONNECT_UNAUTHORIZED - the client was not authorized to connect IS THERE A SIMILAR FUNCTION?

timurufa86 avatar Apr 10 '20 09:04 timurufa86

There is nothing specially implementer for that, but internally the Library uses the mqtt client and TCP client if it is connected over the Mesh. You could take this connection objects and look at the State of these.

simone1999 avatar Jul 07 '20 06:07 simone1999