mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Correctly parse number state for numeric input card feature (#24453)
This commit is contained in:
parent
7120200fd4
commit
76b03d3a40
@ -83,13 +83,16 @@ class HuiNumericInputCardFeature
|
||||
|
||||
const stateObj = this.stateObj;
|
||||
|
||||
const parsedState = Number(stateObj.state);
|
||||
const value = !isNaN(parsedState) ? parsedState : undefined;
|
||||
|
||||
if (this._config.style === "buttons") {
|
||||
return html`
|
||||
<ha-control-number-buttons
|
||||
value=${stateObj.state}
|
||||
min=${stateObj.attributes.min}
|
||||
max=${stateObj.attributes.max}
|
||||
step=${stateObj.attributes.step}
|
||||
.value=${value}
|
||||
.min=${stateObj.attributes.min}
|
||||
.max=${stateObj.attributes.max}
|
||||
.step=${stateObj.attributes.step}
|
||||
@value-changed=${this._setValue}
|
||||
.disabled=${isUnavailableState(stateObj.state)}
|
||||
.unit=${stateObj.attributes.unit_of_measurement}
|
||||
@ -99,10 +102,10 @@ class HuiNumericInputCardFeature
|
||||
}
|
||||
return html`
|
||||
<ha-control-slider
|
||||
value=${stateObj.state}
|
||||
min=${stateObj.attributes.min}
|
||||
max=${stateObj.attributes.max}
|
||||
step=${stateObj.attributes.step}
|
||||
.value=${value}
|
||||
.min=${stateObj.attributes.min}
|
||||
.max=${stateObj.attributes.max}
|
||||
.step=${stateObj.attributes.step}
|
||||
@value-changed=${this._setValue}
|
||||
.disabled=${isUnavailableState(stateObj.state)}
|
||||
.unit=${stateObj.attributes.unit_of_measurement}
|
||||
|
Loading…
x
Reference in New Issue
Block a user