From b573870b82fe9ad60d0d81f29399accb3082018f Mon Sep 17 00:00:00 2001 From: barbudor Date: Sat, 26 Mar 2022 14:45:13 +0100 Subject: [PATCH] TempSet HumSet TimerX always published immediately --- tasmota/xdrv_16_tuyamcu.ino | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index 73ed1782a..2b3fccd8a 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -97,7 +97,9 @@ struct TUYA { // #define D_CMND_TUYA_SET_TIMER "SetTimer" const char kTuyaSensors[] PROGMEM = // List of available sensors (can be expanded in the future) +// 71 72 73 74 75 "" D_JSON_TEMPERATURE "|TempSet|" D_JSON_HUMIDITY "|HumSet|" D_JSON_ILLUMINANCE +// 76 77 78 79 80 81 82 83 84 "|" D_JSON_TVOC "|" D_JSON_ECO2 "|" D_JSON_CO2 "|" D_JSON_GAS "||Timer1|Timer2|Timer3|TImer4"; const char kTuyaCommand[] PROGMEM = D_PRFX_TUYA "|" // Prefix @@ -814,10 +816,14 @@ void TuyaProcessStatePacket(void) { char sname[20]; char tempval[5]; uint8_t res; + bool dont_publish = Settings->flag5.tuyasns_no_immediate; if (TasmotaGlobal.uptime < 8) { // delay to avoid multiple topics at the same time at boot time return; } else { + if (fnId > 80 || fnId == 74 || fnId == 72) { + dont_publish = false; + } if (fnId > 74) { res = 0; } else if (fnId > 72) { @@ -830,7 +836,7 @@ void TuyaProcessStatePacket(void) { GetTextIndexed(sname, sizeof(sname), (fnId-71), kTuyaSensors); ResponseClear(); // Clear retained message Response_P(PSTR("{\"TuyaSNS\":{\"%s\":%s}}"), sname, dtostrfd(TuyaAdjustedTemperature(packetValue, res), res, tempval)); // sensor update is just on change - if (Settings->flag5.tuyasns_no_immediate) { + if (dont_publish) { XdrvRulesProcess(0); } else { MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_CMND_SENSOR));