Skip to content

Commit

Permalink
fix: Fix Tuya ZG-227ZL battery % (#8491)
Browse files Browse the repository at this point in the history
  • Loading branch information
mleone87 authored Dec 20, 2024
1 parent 3356047 commit 3e2bd0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8435,7 +8435,7 @@ const definitions: DefinitionWithExtend[] = [
tuyaDatapoints: [
[1, 'temperature', tuya.valueConverter.divideBy10],
[2, 'humidity', tuya.valueConverter.raw],
[4, 'battery', tuya.valueConverter.raw],
[4, 'battery', tuya.valueConverter.divideBy2],
[9, 'temperature_unit', tuya.valueConverter.temperatureUnit],
[23, 'temperature_calibration', tuya.valueConverter.divideBy10],
[24, 'humidity_calibration', tuya.valueConverter.raw],
Expand Down
3 changes: 2 additions & 1 deletion src/lib/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,12 @@ export const valueConverter = {
countdown: valueConverterBasic.raw(),
scale0_254to0_1000: valueConverterBasic.scale(0, 254, 0, 1000),
scale0_1to0_1000: valueConverterBasic.scale(0, 1, 0, 1000),
divideBy100: valueConverterBasic.divideBy(100),
temperatureUnit: valueConverterBasic.lookup({celsius: 0, fahrenheit: 1}),
temperatureUnitEnum: valueConverterBasic.lookup({celsius: new Enum(0), fahrenheit: new Enum(1)}),
batteryState: valueConverterBasic.lookup({low: 0, medium: 1, high: 2}),
divideBy2: valueConverterBasic.divideBy(2),
divideBy10: valueConverterBasic.divideBy(10),
divideBy100: valueConverterBasic.divideBy(100),
divideBy1000: valueConverterBasic.divideBy(1000),
divideBy10FromOnly: valueConverterBasic.divideByFromOnly(10),
switchMode: valueConverterBasic.lookup({switch: new Enum(0), scene: new Enum(1)}),
Expand Down

0 comments on commit 3e2bd0e

Please sign in to comment.