Merge pull request #15216 from barbudor/tuyasns_so_immediate_publish

SetOption136 disable TuyaSNS immediate publish
This commit is contained in:
Theo Arends 2022-03-25 10:57:36 +01:00 committed by GitHub
commit 5494d47c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -165,7 +165,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t shift595_invert_outputs : 1; // bit 19 (v10.0.0.4) - SetOption133 - (Shift595) Invert outputs of 74x595 shift registers
uint32_t pwm_force_same_phase : 1; // bit 20 (v10.1.0.6) - SetOption134 - (PWM) force PWM lights to start at same phase, default is to spread phases to minimze overlap (also needed for H-bridge)
uint32_t display_no_splash : 1; // bit 21 (v11.0.0.2) - SetOption135 - (Display & LVGL) forece disbabling default splash screen
uint32_t spare22 : 1; // bit 22
uint32_t tuyasns_no_immediate : 1; // bit 22 (v11.0.0.4) - SetOption136 - (TuyaSNS) When ON disable publish single SNS value on Tuya Receive (keep Teleperiod)
uint32_t spare23 : 1; // bit 23
uint32_t spare24 : 1; // bit 24
uint32_t spare25 : 1; // bit 25

View File

@ -830,7 +830,11 @@ 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
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_CMND_SENSOR));
if (Settings->flag5.tuyasns_no_immediate) {
XdrvRulesProcess(0);
} else {
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_CMND_SENSOR));
}
}
}