Update xdrv_16_tuyamcu.ino

Support longer-form TUYA_MCU_FUNC_POWER_COMBINED payloads used by some devices, including "2P 63A TUYA APP WiFi Smart Circuit Earth Leakage Over Under Voltage Protector Relay Device Switch Breaker Energy Power kWh Meter".
This commit is contained in:
ZoneMR 2022-09-13 13:17:39 +01:00 committed by GitHub
parent 5613d57154
commit b1ee94c248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -802,7 +802,7 @@ void TuyaProcessStatePacket(void) {
if (Tuya.buffer[dpidStart + 1] == 0) {
#ifdef USE_ENERGY_SENSOR
if (tuya_energy_enabled && fnId == TUYA_MCU_FUNC_POWER_COMBINED) {
if (dpDataLen == 8) {
if (dpDataLen >= 8) {
uint16_t tmpVol = Tuya.buffer[dpidStart + 4] << 8 | Tuya.buffer[dpidStart + 5];
uint16_t tmpCur = Tuya.buffer[dpidStart + 7] << 8 | Tuya.buffer[dpidStart + 8];
uint16_t tmpPow = Tuya.buffer[dpidStart + 10] << 8 | Tuya.buffer[dpidStart + 11];