I don't understand how to publish to mqtt with retain option (The fourth parameters)
I know that I need length in an byte array but I've try allot to determine how to calculate my payload message to an byte var.
here is my code to publish once I am connected.
String str; char chBright; str = String(ledBrightness); //converting integer into a string str = str + '%'; str.toCharArray(chBright, 4); MQTTClient.publish("/maison/GF/Escalier/stairLight/b", chBright);
document ask the third parameter to be an byte
topic – the topic to publish to
payload – the message to publish
length – the length of the message
retained – whether the message should be retained
0– not retained
How in c++ to get bytes from the message I want to publish?
Tank you to clarify my knowledge