Skip to content

Commit

Permalink
fix: TO-Q-SY2-163JZT unable to set over voltage higher than 255 (#7995)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iaxon authored Sep 16, 2024
1 parent 77603de commit 34b0c30
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@ const tzLocal = {
}
case 'over_voltage_threshold': {
const state = meta.state['over_voltage_breaker'];
const buf = Buffer.from([3, utils.getFromLookup(state, onOffLookup), 0, utils.toNumber(value, 'over_voltage_breaker')]);
const buf = Buffer.alloc(4);
buf.writeUInt8(3, 0);
buf.writeUInt8(utils.getFromLookup(state, onOffLookup), 1);
buf.writeUInt16BE(utils.toNumber(value, 'over_voltage_threshold'), 2);
await entity.command('manuSpecificTuya_3', 'setOptions3', {data: buf});
break;
}
Expand Down

0 comments on commit 34b0c30

Please sign in to comment.