Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
NebzHB authored May 20, 2024
1 parent f4a1899 commit 44aec9f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6437,11 +6437,13 @@ JeedomBridgedAccessory.prototype.delServices = function(accessory) {

// convert range to percentage
function rangeToPercentage(value, min, max) {
if(min == 0 && max == 100) { return value; }
return Math.floor(((value - min) / (max - min)) * 100);
}

// convert percentage to range
function percentageToRange(percentage, min, max) {
if(min == 0 && max == 100) { return percentage; }
return Math.ceil((percentage / 100) * (max - min) + min);
}

Expand Down

0 comments on commit 44aec9f

Please sign in to comment.