Re: Native MQTT client library for ESP8266
Posted:
Tue May 19, 2015 2:05 pm
by j0hncc
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"
Re: Native MQTT client library for ESP8266
Posted:
Thu May 21, 2015 3:56 am
by ian@eagland.co.uk
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
Re: Native MQTT client library for ESP8266
Posted:
Thu May 21, 2015 11:36 am
by ian@eagland.co.uk
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
Re: Native MQTT client library for ESP8266
Posted:
Thu May 21, 2015 12:03 pm
by j0hncc
Hi Ian,
Not sure which mqtt example source code or library you're starting with...?
Are you using arduino? Is it an ESP8266/Arduino library from somewhere in here:
https://github.com/esp8266/Arduino ?
Or here?
https://github.com/knolleary/pubsubclientJohn