Skip to content

Commit

Permalink
fix add_ele unit
Browse files Browse the repository at this point in the history
  • Loading branch information
callemand committed Oct 2, 2023
1 parent 6d8f4de commit 702b1f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/services/tuya/lib/device/tuya.deviceMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const readValues = {
return valueFromDevice === true ? 1 : 0;
},
[DEVICE_FEATURE_TYPES.SWITCH.ENERGY]: (valueFromDevice) => {
return parseInt(valueFromDevice, 10);
return parseInt(valueFromDevice, 10) / 100;
},
[DEVICE_FEATURE_TYPES.SWITCH.CURRENT]: (valueFromDevice) => {
return parseInt(valueFromDevice, 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Tuya device mapping', () => {
});
it('energy', () => {
const result = readValues[DEVICE_FEATURE_CATEGORIES.SWITCH][DEVICE_FEATURE_TYPES.SWITCH.ENERGY]('30');
expect(result).to.eq(30);
expect(result).to.eq(0.3);
});
it('current', () => {
const result = readValues[DEVICE_FEATURE_CATEGORIES.SWITCH][DEVICE_FEATURE_TYPES.SWITCH.CURRENT]('20');
Expand Down

0 comments on commit 702b1f8

Please sign in to comment.