diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index bf887ff19..d9eb64830 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -337,6 +337,7 @@ #define RF_DATA_RADIX false // [SetOption28] RF receive data format (false = hexadecimal, true = decimal) #define IR_DATA_RADIX false // [SetOption29] IR receive data format (false = hexadecimal, true = decimal) #define TUYA_SETOPTION_20 false // [SetOption54] Apply SetOption20 settings to Tuya device +#define TUYA_ALLOW_DIMMER_0 false // [SetOption131] Allow save dimmer = 0 receved by MCU #define TUYA_TEMP_SET_RES 1 // [TuyaTempSetRes] Maximum number of decimals (0 - 3) showing sensor TemperatureSet #define IR_ADD_RAW_DATA false // [SetOption58] Add IR Raw data to JSON message #define BUZZER_ENABLE false // [SetOption67] Enable buzzer when available diff --git a/tasmota/settings.h b/tasmota/settings.h index c75842aac..b168422fc 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -160,7 +160,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t disable_referer_chk : 1; // bit 14 (v9.5.0.5) - SetOption128 - (Web) Allow access without referer check uint32_t energy_phase : 1; // bit 15 (v9.5.0.9) - SetOption129 - (Energy) Show phase information uint32_t show_heap_with_timestamp : 1; // bit 16 (v9.5.0.9) - SetOption130 - (Debug) Show heap with logging timestamp - uint32_t spare17 : 1; // bit 17 + uint32_t tuya_allow_dimmer_0 : 1; // bit 17 (v10.0.0.3) - SetOption131 - (Tuya) Allow save dimmer = 0 receved by MCU uint32_t spare18 : 1; // bit 18 uint32_t spare19 : 1; // bit 19 uint32_t spare20 : 1; // bit 20 diff --git a/tasmota/settings.ino b/tasmota/settings.ino index ec09129f4..bab1870db 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -1182,6 +1182,7 @@ void SettingsDefaultSet2(void) { // Tuya flag3.tuya_apply_o20 |= TUYA_SETOPTION_20; + flag5.tuya_allow_dimmer_0 |= TUYA_ALLOW_DIMMER_0; flag3.tuya_serial_mqtt_publish |= MQTT_TUYA_RECEIVED; mbflag2.temperature_set_res |= TUYA_TEMP_SET_RES; diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index 43b703c82..f44ea864f 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -842,7 +842,8 @@ void TuyaProcessStatePacket(void) { (fnId == TUYA_MCU_FUNC_CT) || (fnId == TUYA_MCU_FUNC_WHITE)) { if (Tuya.ignore_dimmer_cmd_timeout < millis()) { - if ((TasmotaGlobal.power || Settings->flag3.tuya_apply_o20) && ((Tuya.Levels[dimIndex] > 0) && (Tuya.Levels[dimIndex] != Tuya.Snapshot[dimIndex]))) { // SetOption54 - Apply SetOption20 settings to Tuya device + //if ((TasmotaGlobal.power || Settings->flag3.tuya_apply_o20) && ((Tuya.Levels[dimIndex] > 0) && (Tuya.Levels[dimIndex] != Tuya.Snapshot[dimIndex]))) { // SetOption54 - Apply SetOption20 settings to Tuya device + if ((TasmotaGlobal.power || Settings->flag3.tuya_apply_o20) && ((Tuya.Levels[dimIndex] > 0 || Settings->flag5.tuya_allow_dimmer_0) && (Tuya.Levels[dimIndex] != Tuya.Snapshot[dimIndex]))) { // SetOption54 - Apply SetOption20 settings to Tuya device Tuya.ignore_dim = true; TasmotaGlobal.skip_light_fade = true;