diff --git a/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino b/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino index 2e4386ad5..bd316122e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v1.ino @@ -1334,12 +1334,21 @@ void TuyaSerialInput(void) ResponseAppend_P(PSTR("}}")); if (Settings->flag3.tuya_serial_mqtt_publish) { // SetOption66 - Enable TuyaMcuReceived messages over Mqtt +/* for (uint8_t cmdsID = 0; sizeof(TuyaExcludeCMDsFromMQTT) > cmdsID; cmdsID++){ if (TuyaExcludeCMDsFromMQTT[cmdsID] == Tuya.buffer[3]) { isCmdToSuppress = true; break; } } +*/ + for (uint8_t cmdsID = 0; cmdsID < sizeof(TuyaExcludeCMDsFromMQTT); cmdsID++) { + if (pgm_read_byte(TuyaExcludeCMDsFromMQTT +cmdsID) == Tuya.buffer[3]) { + isCmdToSuppress = true; + break; + } + } + if (!(isCmdToSuppress && Settings->flag5.tuya_exclude_from_mqtt)) { // SetOption137 - (Tuya) When Set, avoid the (MQTT-) publish of defined Tuya CMDs (see TuyaExcludeCMDsFromMQTT) if SetOption66 is active MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED)); } else { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v2.ino b/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v2.ino index 84589b42c..6c3eb15d5 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v2.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_16_tuyamcu_v2.ino @@ -2120,12 +2120,21 @@ void TuyaProcessCommand(unsigned char *buffer){ // SetOption66 - Enable TuyaMcuReceived messages over Mqtt if (Settings->flag3.tuya_serial_mqtt_publish) { +/* for (uint8_t cmdsID = 0; sizeof(TuyaExcludeCMDsFromMQTT) > cmdsID; cmdsID++){ if (TuyaExcludeCMDsFromMQTT[cmdsID] == cmd) { isCmdToSuppress = true; break; } } +*/ + for (uint8_t cmdsID = 0; cmdsID < sizeof(TuyaExcludeCMDsFromMQTT); cmdsID++) { + if (pgm_read_byte(TuyaExcludeCMDsFromMQTT +cmdsID) == Tuya.buffer[3]) { + isCmdToSuppress = true; + break; + } + } + // SetOption137 - (Tuya) When Set, avoid the (MQTT-) publish of defined Tuya CMDs // (see TuyaExcludeCMDsFromMQTT) if SetOption66 is active if (!(isCmdToSuppress && Settings->flag5.tuya_exclude_from_mqtt)) {