Chat freely about anything...

User avatar
By scargill
#17822 No that's not normal - well everything is until disconnected. It should stay connected.

ian@eagland.co.uk wrote:Hi

I finally got this compiled and flashed after a considerable learning curve being an ESP and C novice. However I am not sure I am not sure I have set it up correctly. The Coms ports shows this:-

URL changed to protect privacy
Free memory
TCP: Connect to ip ???.78.46.??0:1883
TCP: Reconnect to: ???.78.46.??0:1883
MQTT: Connected to broker ???.78.46.??0:1883
MQTT: Sending, type: 0, id: 0000

Then after a long delay I get:-
TCP: Disconnected callback
MQTT: Disconnected

Is this normal and what does it mean?
I am using mosquitto on a Pi as the broker.
Also what is the best method of updating the library when there are changes? I am using the version that came with Unofficial Development Kit for Espressif ESP8266 + eclipse.

Regards

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

Now looking at the mosquitto log and find this entry:-

1432050523: Client mqttjs_929a9b9e has exceeded timeout, disconnecting.
1432050523: Socket error on client mqttjs_929a9b9e, disconnecting.

This coincides with the disconnect in the ESP terminal. I don't see any received publish from the ESP. What does exceeding timeout mean? What is mosquitto expecting from the ESP?
I have now tried connecting directly to the local network in case going over the internet was the cause but still the same result. I see the connection made in the mosquitto log .
New connection from 192.168.1.3 on port 1883 so it is connecting OK but I still get
TCP: Disconnected callback & MQTT: Disconnected in the ESP terminal.

I have just realised that all other connections show a line in the mosquitto log like
New client connected from 127.0.0.1 as mqtt_a18d8098.5e728
on the line after:-
New connection from 127.0.0.1 on port 1883.

I don't get this from the ESP connection so I must be missing something in the ESP set up. I am not using any security at the moment. Could that cause an issue?
I have
#define MQTT_CLIENT_ID ""
#define MQTT_USER ""
#define MQTT_PASS ""
&
#define DEFAULT_SECURITY 0

Any suggestions as to what to try next would be appreciated.

Regards

Ian
User avatar
By j0hncc
#17880 Hi Ian,

Did you confirm version compatibility between mosquitto and the espmqtt lib you're using on ESP? I seem to remember I had to upgrade or downgrade my mosquitto installation to accomodate the need of the esp library. I don't have it in front of me at the moment or I might be able to be more specific.

Cheers,
John
User avatar
By ian@eagland.co.uk
#17884 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?

Regards

Ian