Skip to content

Commit

Permalink
Fix getSpeedLevel setSpeedLevel logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ikaruswill committed May 21, 2022
1 parent cb6a465 commit 1837024
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fan-xiaomi.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ class FanXiaomi extends HTMLElement {
}

setSpeedLevel(hass, value) {
let speedPercentage = Math.round(value / this.supportedAttributes.speedLevels) * 100
let speedPercentage = value / this.supportedAttributes.speedLevels * 100
this.setSpeedPercentage(hass, speedPercentage)
}

getSpeedLevel(hass) {
let speedPercentage = Number(hass.states[this.config.entity].attributes['speed'])
let speedPercentage = this.getSpeedPercentage(hass)
return Math.round(speedPercentage / 100 * this.supportedAttributes.speedLevels)
}

Expand Down

0 comments on commit 1837024

Please sign in to comment.