Skip to content

Commit

Permalink
Merge pull request #2 from rohankapoorcom/animate-speedless-fans-upst…
Browse files Browse the repository at this point in the history
…ream

Animate speedless fans upstream
  • Loading branch information
lizsugar authored Apr 25, 2022
2 parents 88e3567 + 8214cfe commit fadd518
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/controllers/fan-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class FanController extends Controller {
}

get _step(): number {
return this.stateObj.attributes.percentage_step;
return this.hasSlider ? this.stateObj.attributes.percentage_step : 1;
}

get label(): string {
Expand All @@ -57,9 +57,14 @@ export class FanController extends Controller {

get iconRotateSpeed(): string {
let speed = 0;
if (this.percentage > 0) {
speed = 3 - ((this.percentage / 100) * 2);
if (this.hasSlider) {
if (this.percentage > 0) {
speed = 3 - ((this.percentage / 100) * 2);
}
} else {
speed = this._value
}

return `${speed}s`
}

Expand Down

0 comments on commit fadd518

Please sign in to comment.