Skip to content

Commit 34b0c30

Browse files
authored
fix: TO-Q-SY2-163JZT unable to set over voltage higher than 255 (#7995)
As described this comment Koenkk/zigbee2mqtt#21999 (comment) it wasn't possible to set the over voltage protection over 255. That was due to a overflow. The fix is tested in hassio-zigbee2mqtt
1 parent 77603de commit 34b0c30

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/devices/tuya.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,10 @@ const tzLocal = {
496496
}
497497
case 'over_voltage_threshold': {
498498
const state = meta.state['over_voltage_breaker'];
499-
const buf = Buffer.from([3, utils.getFromLookup(state, onOffLookup), 0, utils.toNumber(value, 'over_voltage_breaker')]);
499+
const buf = Buffer.alloc(4);
500+
buf.writeUInt8(3, 0);
501+
buf.writeUInt8(utils.getFromLookup(state, onOffLookup), 1);
502+
buf.writeUInt16BE(utils.toNumber(value, 'over_voltage_threshold'), 2);
500503
await entity.command('manuSpecificTuya_3', 'setOptions3', {data: buf});
501504
break;
502505
}

0 commit comments

Comments
 (0)