diff --git a/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts index f6888a5d02af..d6261866fbc4 100644 --- a/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts @@ -173,13 +173,10 @@ class HuiInputNumberEntityRow extends LitElement implements LovelaceRow { private _selectedValueChanged(ev: Event): void { const stateObj = this.hass!.states[this._config!.entity]; + const target = ev.target as HTMLInputElement; - if ((ev.target as HTMLInputElement).value !== stateObj.state) { - setValue( - this.hass!, - stateObj.entity_id, - (ev.target as HTMLInputElement).value - ); + if (target.value !== stateObj.state && !target.validity.stepMismatch) { + setValue(this.hass!, stateObj.entity_id, target.value); } } } diff --git a/src/panels/lovelace/entity-rows/hui-number-entity-row.ts b/src/panels/lovelace/entity-rows/hui-number-entity-row.ts index 1b57c6ee4135..7614d5faaf2a 100644 --- a/src/panels/lovelace/entity-rows/hui-number-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-number-entity-row.ts @@ -179,9 +179,10 @@ class HuiNumberEntityRow extends LitElement implements LovelaceRow { private _selectedValueChanged(ev): void { const stateObj = this.hass!.states[this._config!.entity]; + const target = ev.target as HTMLInputElement; - if (ev.target.value !== stateObj.state) { - setValue(this.hass!, stateObj.entity_id, ev.target.value!); + if (target.value !== stateObj.state && !target.validity.stepMismatch) { + setValue(this.hass!, stateObj.entity_id, target.value); } } } diff --git a/src/state-summary/state-card-input_number.ts b/src/state-summary/state-card-input_number.ts index 884253d3e67e..19d4aebd72e0 100644 --- a/src/state-summary/state-card-input_number.ts +++ b/src/state-summary/state-card-input_number.ts @@ -143,7 +143,8 @@ class StateCardInputNumber extends LitElement { } private _selectedValueChanged(ev: Event): void { - if ((ev.target as HTMLInputElement).value !== this.stateObj.state) { + const target = ev.target as HTMLInputElement; + if (target.value !== this.stateObj.state && !target.validity.stepMismatch) { setValue( this.hass!, this.stateObj.entity_id, diff --git a/src/state-summary/state-card-number.ts b/src/state-summary/state-card-number.ts index 10cda4b7dd5b..b7cc561022f6 100644 --- a/src/state-summary/state-card-number.ts +++ b/src/state-summary/state-card-number.ts @@ -120,8 +120,9 @@ class StateCardNumber extends LitElement { } private async _selectedValueChanged(ev: Event) { - const value = (ev.target as HTMLInputElement).value; - if (value === this.stateObj.state) { + const target = ev.target as HTMLInputElement; + const value = target.value; + if (value === this.stateObj.state || target.validity.stepMismatch) { return; } await this.hass.callService("number", "set_value", {