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

Setter method setMqttClientName #61

Merged
merged 1 commit into from
Sep 10, 2020
Merged

Conversation

markreds81
Copy link
Contributor

Added a setter method to set mqttClientName property after instantiation. This allows to use a custom string built at runtime, for example, add the ESP mac address as suffix. See the following example:

char hostname[12];
EspMQTTClient client("MySSID", "MyPass", "5.196.95.208", NULL, NULL, NULL,  1883);

void setup() {	
	byte mac[6];
	WiFi.macAddress(mac);
	sprintf(hostname, "MyThing-%02X%02X", mac[4], mac[5]);
	client.setMqttClientName(hostname);
}

Added a setter method to set mqttClientName property after instantiation.
@plapointe6 plapointe6 merged commit 1e5832a into plapointe6:master Sep 10, 2020
@plapointe6
Copy link
Owner

Thanks for your contribution.
This will work if you call setMqttClientName() in the setup() before any loop() calls.

Merged

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

Successfully merging this pull request may close these issues.

2 participants