ESP-MQTT Event Handler Failure
Posted: Mon Oct 21, 2019 12:00 am
Hi everybody. Long time.
Subject: ESP-MQTT and mqtt_event_handler.
Using espidf version 3.3 downloaded 1 hour ago, using example of wifi/getting-started and added the esp-mqtt example emitter-client for mqtt handling, broker is Cloudmqtt.
Local wifi connects and then I starts a cycle(about 10-15 secs) of [connect-sendmsg-disconnect(start-publish-stop)]. The result is as follows in the mqtt-event-handler.
1) Start->handler gets called and shows Connected.
2) esp_mqtt_client_publish(clientCloud,....) is called, the message is received in the broker(seen from a monitoring station) BUT no PUBLISHED event is called.
3)esp_stop is called BUT NO event is called.
4) There is an mqtt event #7 (not documented in the APIs)
If I change the menuconfig and disable mqtt 3.1.1 events are sent to the handler but network failure happens all the time and actually DISCONNECT gets called.
The way its implemented is via a semaphore but the EVENT_MANAGER itself should be the trigger for next phase of the cycle like:
Start->CONNECT->send msg->PUBLISHED->Stop->DISCONNECT
Any help welcomed.
App is included, BTW it manages an gpio_isr which is the event trigger (at X interrupt count)
Many thanks.
RSN
Subject: ESP-MQTT and mqtt_event_handler.
Using espidf version 3.3 downloaded 1 hour ago, using example of wifi/getting-started and added the esp-mqtt example emitter-client for mqtt handling, broker is Cloudmqtt.
Local wifi connects and then I starts a cycle(about 10-15 secs) of [connect-sendmsg-disconnect(start-publish-stop)]. The result is as follows in the mqtt-event-handler.
1) Start->handler gets called and shows Connected.
2) esp_mqtt_client_publish(clientCloud,....) is called, the message is received in the broker(seen from a monitoring station) BUT no PUBLISHED event is called.
3)esp_stop is called BUT NO event is called.
4) There is an mqtt event #7 (not documented in the APIs)
If I change the menuconfig and disable mqtt 3.1.1 events are sent to the handler but network failure happens all the time and actually DISCONNECT gets called.
- A partial log file with the cycle can be seen.
Got Ip, so we are connected to the network
Task is waiting of X event to start mqtt message delivery
Gets the Event and
"Starting mqtt client"--> funny gets event 7 (not documented) then another event 1 Connection and Gets the Connect event
"Sending status...publish"--> gets no EVENT whatsoever but the messages is received by the Broker
"Stop Mqtt...disconnect"--> gets no EVENT
and the Waiting Queue starts the cycle again
cycle starts again, all messages are received.
The way its implemented is via a semaphore but the EVENT_MANAGER itself should be the trigger for next phase of the cycle like:
Start->CONNECT->send msg->PUBLISHED->Stop->DISCONNECT
Any help welcomed.
App is included, BTW it manages an gpio_isr which is the event trigger (at X interrupt count)
Many thanks.
RSN