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

Return values of MqttClient::subscribe not documented #100

Open
UchihaYuki opened this issue Feb 20, 2024 · 4 comments
Open

Return values of MqttClient::subscribe not documented #100

UchihaYuki opened this issue Feb 20, 2024 · 4 comments
Labels
topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project

Comments

@UchihaYuki
Copy link

auto result = mqttClient.subscribe(commandTopic);
Serial.printf("Subscription result %d\n", result);

Since there isn't doc yet I don't know what happened.

The MQTT broker I use is Mosquitto broker, I use it with Home Assistant. I set the version to 3.1.1. As far as I know, ArduinoMqttClient uses 3.1.1 as well. I don't know what happened so that subscribe failed. Or 1 means successful? But I haven't received any message from the broker.

@UchihaYuki
Copy link
Author

I can observe the message gets sent to the MQTT broker by using MQTT Explorer. It's just my Arduino device can't receive the message.

@per1234 per1234 changed the title mqttClient.subscribe returned 1 and never receive any message Return values of MqttClient::subscribe not documented Feb 20, 2024
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: documentation Related to documentation for the project labels Feb 20, 2024
@UchihaYuki
Copy link
Author

I found the reason why I didn't receive any message because I forgot to call mqttClient.poll().

I just changed my MQTT broker, and this time I got a return code of 0 and can't receive any message.

@UchihaYuki
Copy link
Author

Any updates on what return code 0 means?

@UchihaYuki
Copy link
Author

After switching to pubsubclient, it works now. I also tried arduino-mqtt, it doesn't work either, but it at least gives me an error code, although the error code is not that helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: documentation Related to documentation for the project type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants