diff --git a/src/components/ha-slider.js b/src/components/ha-slider.js index f520fa20e..995f273a1 100644 --- a/src/components/ha-slider.js +++ b/src/components/ha-slider.js @@ -79,6 +79,10 @@ class HaSlider extends PaperSliderClass { return subTemplate; } + _setImmediateValue(newImmediateValue) { + super._setImmediateValue(Math.round(newImmediateValue)); + } + _calcStep(value) { if (!this.step) { return parseFloat(value); diff --git a/src/dialogs/more-info/controls/more-info-fan.js b/src/dialogs/more-info/controls/more-info-fan.js index a5b1b5df5..93bbe5939 100644 --- a/src/dialogs/more-info/controls/more-info-fan.js +++ b/src/dialogs/more-info/controls/more-info-fan.js @@ -52,6 +52,7 @@ class MoreInfoFan extends LocalizeMixin(EventsMixin(PolymerElement)) { caption="[[localize('ui.card.fan.speed')]]" min="0" max="100" + step="[[computePercentageStepSize(stateObj)]]" value="{{percentageSliderValue}}" on-change="percentageChanged" pin="" @@ -113,7 +114,7 @@ class MoreInfoFan extends LocalizeMixin(EventsMixin(PolymerElement)) { `; } @@ -154,6 +155,13 @@ class MoreInfoFan extends LocalizeMixin(EventsMixin(PolymerElement)) { } } + computePercentageStepSize(stateObj) { + if (stateObj.attributes.percentage_step) { + return stateObj.attributes.percentage_step; + } + return 1; + } + computeClassNames(stateObj) { return ( "more-info-fan " +