Chat freely about anything...

User avatar
By j0hncc
#17886
ian@eagland.co.uk wrote:Hi John

Thanks for replying. I am using 1.4.2 which is the latest version. I believe Peter Scargill is also using the latest version successfuly. Perhaps if he reads this he will confirm. Just a thought, does it matter if it is set to mqtt v3.1 or should it be mqtt v3.1.1?


That's what I'm talking about, make sure the protocol your mosquitto supports (3.1/3.1.1) matches what your espmqtt library supports (3.1/3.1.1). "Just a thought" :)
User avatar
By ian@eagland.co.uk
#18036 Hi John

My problem SOLVED

Tried changing the protocol and it made no difference.

However I then switched to Arduino IDE and uploaded a simple MQTT programme and it worked so the ESP is not malfunctioning. Looking at the mosquitto log I saw the Arduino programme was posting a clientid. I had that blank in the Eclipse header file. Added MQTT_CLIENT_ID "ESPProto" and I am delighted it is now working!

Thanks for your suggestions.

Regards

Ian
User avatar
By ian@eagland.co.uk
#18082 Hi

Last Will setup

Tuan says add this to mqtt.c

char willTopic[] = "/lwt";
char willMessage[] = "offline";

mqttClient->connect_info.will_topic = willTopic;
mqttClient->connect_info.will_message = willMessage;
mqttClient->connect_info.will_qos = 0;
mqttClient->connect_info.will_retain = 0;

As a complete beginner to C where should this be placed in the file?
Regards

Ian