mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +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 stateObj = this.stateObj;
|
||||||
|
|
||||||
|
const parsedState = Number(stateObj.state);
|
||||||
|
const value = !isNaN(parsedState) ? parsedState : undefined;
|
||||||
|
|
||||||
if (this._config.style === "buttons") {
|
if (this._config.style === "buttons") {
|
||||||
return html`
|
return html`
|
||||||
<ha-control-number-buttons
|
<ha-control-number-buttons
|
||||||
value=${stateObj.state}
|
.value=${value}
|
||||||
min=${stateObj.attributes.min}
|
.min=${stateObj.attributes.min}
|
||||||
max=${stateObj.attributes.max}
|
.max=${stateObj.attributes.max}
|
||||||
step=${stateObj.attributes.step}
|
.step=${stateObj.attributes.step}
|
||||||
@value-changed=${this._setValue}
|
@value-changed=${this._setValue}
|
||||||
.disabled=${isUnavailableState(stateObj.state)}
|
.disabled=${isUnavailableState(stateObj.state)}
|
||||||
.unit=${stateObj.attributes.unit_of_measurement}
|
.unit=${stateObj.attributes.unit_of_measurement}
|
||||||
@ -99,10 +102,10 @@ class HuiNumericInputCardFeature
|
|||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-control-slider
|
<ha-control-slider
|
||||||
value=${stateObj.state}
|
.value=${value}
|
||||||
min=${stateObj.attributes.min}
|
.min=${stateObj.attributes.min}
|
||||||
max=${stateObj.attributes.max}
|
.max=${stateObj.attributes.max}
|
||||||
step=${stateObj.attributes.step}
|
.step=${stateObj.attributes.step}
|
||||||
@value-changed=${this._setValue}
|
@value-changed=${this._setValue}
|
||||||
.disabled=${isUnavailableState(stateObj.state)}
|
.disabled=${isUnavailableState(stateObj.state)}
|
||||||
.unit=${stateObj.attributes.unit_of_measurement}
|
.unit=${stateObj.attributes.unit_of_measurement}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user