Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp_mqtt_cxx not set last will (IDFGH-12648) #554

Closed
3 tasks done
cubesky opened this issue Apr 18, 2024 · 0 comments
Closed
3 tasks done

esp_mqtt_cxx not set last will (IDFGH-12648) #554

cubesky opened this issue Apr 18, 2024 · 0 comments

Comments

@cubesky
Copy link

cubesky commented Apr 18, 2024

Answers checklist.

  • I have read the documentation for esp-protocols components and the issue is not addressed there.
  • I have updated my esp-protocols branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

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.

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;
@github-actions github-actions bot changed the title esp_mqtt_cxx not set last will esp_mqtt_cxx not set last will (IDFGH-12648) Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants