diff --git a/src/MqttHandleHuawei.cpp b/src/MqttHandleHuawei.cpp index f13ac07b..cae27c40 100644 --- a/src/MqttHandleHuawei.cpp +++ b/src/MqttHandleHuawei.cpp @@ -73,6 +73,11 @@ void MqttHandleHuaweiClass::onMqttMessage(const espMqttClientTypes::MessagePrope { const CONFIG_T& config = Configuration.get(); + // ignore messages if Huawei is disabled + if (!config.Huawei_Enabled) { + return; + } + char token_topic[MQTT_MAX_TOPIC_STRLEN + 40]; // respect all subtopics strncpy(token_topic, topic, MQTT_MAX_TOPIC_STRLEN + 40); // convert const char* to char* diff --git a/src/MqttHandlePowerLimiter.cpp b/src/MqttHandlePowerLimiter.cpp index fdff3ee7..5090b1ca 100644 --- a/src/MqttHandlePowerLimiter.cpp +++ b/src/MqttHandlePowerLimiter.cpp @@ -49,6 +49,11 @@ void MqttHandlePowerLimiterClass::loop() void MqttHandlePowerLimiterClass::onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total) { const CONFIG_T& config = Configuration.get(); + + // ignore messages if PowerLimiter is disabled + if (!config.PowerLimiter_Enabled) { + return; + } char token_topic[MQTT_MAX_TOPIC_STRLEN + 40]; // respect all subtopics strncpy(token_topic, topic, MQTT_MAX_TOPIC_STRLEN + 40); // convert const char* to char*