Meine anpassungen wegen

MQTT Intervall
	MQTT Test

	MQTT Subscribe muss nur nach dem MQTT Connect nicht bei jedem Connect Check
This commit is contained in:
HorstG-57 2022-08-10 23:15:50 +02:00
parent 6276957b22
commit 4dc64eb2d7
2 changed files with 28 additions and 6 deletions

View file

@ -121,12 +121,13 @@ class mqtt {
else
mClient->connect(mDevName);
}
// ein Subscribe ist nur nach einem connect notwendig
char topic[MQTT_TOPIC_LEN + 13 ]; // "/devcontrol/#" --> + 6 byte
// ToDo: "/devcontrol/#" is hardcoded
snprintf(topic, MQTT_TOPIC_LEN + 13, "%s/devcontrol/#", mTopic);
DPRINTLN(DBG_INFO, F("subscribe to ") + String(topic));
mClient->subscribe(topic); // subscribe to mTopic + "/devcontrol/#"
}
char topic[MQTT_TOPIC_LEN + 13 ]; // "/devcontrol/#" --> + 6 byte
// ToDo: "/devcontrol/#" is hardcoded
snprintf(topic, MQTT_TOPIC_LEN + 13, "%s/devcontrol/#", mTopic);
DPRINTLN(DBG_INFO, F("subscribe to ") + String(topic));
mClient->subscribe(topic); // subscribe to mTopic + "/devcontrol/#"
}
WiFiClient mEspClient;