Closed seedzhoukang closed 5 years ago
I'll receive on and off at the same time when I manually turn on the Tuya device, and I'll receive off and off when I turn off the device.
I don't know if I'm the only one with this error, here's the code I found the problem with:
TuyaDevice.onAll('data', function (data) { try { debugTuya('Data from device ' + this.type + ' :', data); var status = data.dps['1']; if (this.type == "lightbulb" && status == undefined) { status = true; } publishStatus(this, bmap(status)); publishDPS(this, data.dps); } catch (e) { debugError(e); } });
data will receive two times the metadata {"1": true} and {"11": 0}, which will cause the status to produce a undefined
data
{"1": true}
{"11": 0}
status
undefined
When I judge status as undefined, I do nothing to solve the above problems.
This should be the same error as in error #11
Duplicate of #11
I'll receive on and off at the same time when I manually turn on the Tuya device, and I'll receive off and off when I turn off the device.
I don't know if I'm the only one with this error, here's the code I found the problem with:
data
will receive two times the metadata{"1": true}
and{"11": 0}
, which will cause thestatus
to produce aundefined
When I judge
status
asundefined
, I do nothing to solve the above problems.