fixed climate card mqtt crash bug
This commit is contained in:
parent
9cd5b7132b
commit
4c77474a94
8 changed files with 128 additions and 50 deletions
|
@ -5,15 +5,19 @@ void IoTComponent::setMqttClient(PubSubClient *mqtt) {
|
|||
}
|
||||
|
||||
void IoTComponent::publishRelative(const char *topic, const char *payload) {
|
||||
char absolute_topic[100];
|
||||
static char absolute_topic[100];
|
||||
sprintf(absolute_topic, "%s/%02d/%s", base_topic, card_id, topic);
|
||||
mqtt->publish(absolute_topic, payload);
|
||||
mqtt->loop();
|
||||
delay(50);
|
||||
}
|
||||
|
||||
void IoTComponent::subscribeRelative(const char *topic) {
|
||||
char absolute_topic[50];
|
||||
sprintf(absolute_topic, "%s/%02d/%s", base_topic, card_id, topic);
|
||||
ESP_LOGD("IoTComponent", "Subscribing to %s", absolute_topic);
|
||||
mqtt->subscribe(absolute_topic);
|
||||
mqtt->loop();
|
||||
}
|
||||
|
||||
void IoTComponent::loop() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue