Closed cubesky closed 2 months ago
I'm using espressif/esp_mqtt_cxx: "^0.3.0" in managed_components. I set the last will with following struct, but it not work.
espressif/esp_mqtt_cxx: "^0.3.0"
static idf::mqtt::Configuration config = { .session = { .last_will = { .lwt_topic = willTopic, .lwt_msg = willData, .lwt_qos = (int)idf::mqtt::QoS::AtLeastOnce, .lwt_retain = (int)idf::mqtt::Retain::Retained }, .keepalive = 10, .disable_keepalive = false } };
It seems it missing config on this method.
https://github.com/espressif/esp-protocols/blob/master/components/esp_mqtt_cxx/esp_mqtt_cxx.cpp#L135
When I manually add these line in this method, will message work.
mqtt_client_cfg.session.last_will.topic = config.session.last_will.lwt_topic; mqtt_client_cfg.session.last_will.msg = config.session.last_will.lwt_msg; mqtt_client_cfg.session.last_will.qos = config.session.last_will.lwt_qos; mqtt_client_cfg.session.last_will.retain = config.session.last_will.lwt_retain; mqtt_client_cfg.session.last_will.msg_len = config.session.last_will.lwt_msg_len; mqtt_client_cfg.session.disable_keepalive = config.session.disable_keepalive; mqtt_client_cfg.session.keepalive = config.session.keepalive;
Answers checklist.
General issue report
I'm using
espressif/esp_mqtt_cxx: "^0.3.0"
in managed_components. I set the last will with following struct, but it not work.It seems it missing config on this method.
https://github.com/espressif/esp-protocols/blob/master/components/esp_mqtt_cxx/esp_mqtt_cxx.cpp#L135
When I manually add these line in this method, will message work.