Skip to content

Commit

Permalink
round voltage value to XX.XX
Browse files Browse the repository at this point in the history
  • Loading branch information
thunder committed Mar 19, 2018
1 parent 248e364 commit 7f02904
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/devices/gateway/voltage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = Thing.mixin(Parent => class extends Parent.with(BatteryLevel) {

propertyUpdated(key, value, oldValue) {
if(key === 'voltage' && value) {
this.updateBatteryLevel((value - VOLTAGE_MIN) / (VOLTAGE_MAX - VOLTAGE_MIN) * 100);
this.updateBatteryLevel(Number((value - VOLTAGE_MIN) / (VOLTAGE_MAX - VOLTAGE_MIN) * 100).toFixed(2));
}

super.propertyUpdated(key, value, oldValue);
Expand Down

0 comments on commit 7f02904

Please sign in to comment.