Skip to content

Commit

Permalink
fix add_ele unit
Browse files Browse the repository at this point in the history
  • Loading branch information
callemand authored and Corentin Allemand committed Oct 16, 2023
1 parent d388a83 commit 141afef
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 @@ -167,7 +167,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 @@ -76,7 +76,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 141afef

Please sign in to comment.