Is it possible to get the value of a mqtt subscription without a subscription value change?
Basically, I want to know the value of a mqtt subscription at the beginning of my program. I have not been able to find any commands that will give me the output of a subscription without a value change of the subscription. This is the code I am using now.
Adafruit_MQTT_Subscribe *subscription;
while ((subscription = mqtt.readSubscription(5000))) {
Serial.print(F("Received Alert Control Data "));
if (subscription == &alertsButton) {
if (((char *)alertsButton.lastread) == "ON ") {
Serial.println(F("(Alerts Active) "));
alertsA = 1;
} else {
Serial.println(F("(Alerts Not Active) "));
alertsA = 0;
}
newSubscription = 1;
}
}
Thanks in advance!