mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix displayed unit for fixed water price (#16616)
This commit is contained in:
parent
50bd9da94c
commit
cccce5711c
@ -83,10 +83,14 @@ export class DialogEnergyWaterSettings
|
|||||||
|
|
||||||
const pickableUnit = this._water_units?.join(", ") || "";
|
const pickableUnit = this._water_units?.join(", ") || "";
|
||||||
|
|
||||||
const unitPrice = this._pickedDisplayUnit
|
const unitPriceSensor = this._pickedDisplayUnit
|
||||||
? `${this.hass.config.currency}/${this._pickedDisplayUnit}`
|
? `${this.hass.config.currency}/${this._pickedDisplayUnit}`
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
const unitPriceFixed = `${this.hass.config.currency}/${
|
||||||
|
this.hass.config.unit_system.volume === "gal" ? "gal" : "m³"
|
||||||
|
}`;
|
||||||
|
|
||||||
const externalSource =
|
const externalSource =
|
||||||
this._source.stat_energy_from &&
|
this._source.stat_energy_from &&
|
||||||
isExternalStatistic(this._source.stat_energy_from);
|
isExternalStatistic(this._source.stat_energy_from);
|
||||||
@ -189,7 +193,7 @@ export class DialogEnergyWaterSettings
|
|||||||
.value=${this._source.entity_energy_price}
|
.value=${this._source.entity_energy_price}
|
||||||
.label=${`${this.hass.localize(
|
.label=${`${this.hass.localize(
|
||||||
"ui.panel.config.energy.water.dialog.cost_entity_input"
|
"ui.panel.config.energy.water.dialog.cost_entity_input"
|
||||||
)}${unitPrice ? ` (${unitPrice})` : ""}`}
|
)}${unitPriceSensor ? ` (${unitPriceSensor})` : ""}`}
|
||||||
@value-changed=${this._priceEntityChanged}
|
@value-changed=${this._priceEntityChanged}
|
||||||
></ha-entity-picker>`
|
></ha-entity-picker>`
|
||||||
: ""}
|
: ""}
|
||||||
@ -210,13 +214,13 @@ export class DialogEnergyWaterSettings
|
|||||||
? html`<ha-textfield
|
? html`<ha-textfield
|
||||||
.label=${`${this.hass.localize(
|
.label=${`${this.hass.localize(
|
||||||
"ui.panel.config.energy.water.dialog.cost_number_input"
|
"ui.panel.config.energy.water.dialog.cost_number_input"
|
||||||
)}${unitPrice ? ` (${unitPrice})` : ""}`}
|
)} (${unitPriceFixed})`}
|
||||||
class="price-options"
|
class="price-options"
|
||||||
step=".01"
|
step="any"
|
||||||
type="number"
|
type="number"
|
||||||
.value=${this._source.number_energy_price}
|
.value=${this._source.number_energy_price}
|
||||||
@change=${this._numberPriceChanged}
|
@change=${this._numberPriceChanged}
|
||||||
.suffix=${unitPrice || ""}
|
.suffix=${unitPriceFixed}
|
||||||
>
|
>
|
||||||
</ha-textfield>`
|
</ha-textfield>`
|
||||||
: ""}
|
: ""}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user