2018-12-09, 08:46 AM
(2018-12-09, 01:58 AM)cepicscepics Wrote: the esp connect to my home wifi but the serial monitor say:
Connecting to MyHomeWiFi
............
WiFi connected
IP address:
***.***.*.**
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Did you check what state 5 means? https://pubsubclient.knolleary.net/api.html#state
It is
Code:
MQTT_CONNECT_UNAUTHORIZED
First I would try to make sure you can connect to the broker from your computer with for example mosquitto_sub.
I suspect you have OpenPlotter's own Mqtt server configured with a username/password and your client is trying to connect to that.
Try changing the SK mqtt gateway's port something else, like 11883 and adjust your esp code accordingly. There should be also error messages in your RPi's syslog complaining about the gateway's mqtt broker (Mosca) not starting, if there is already the OpenPlotter-managed mqtt broker occupying the port 1883.