Fix unit label for static grid energy price (#17508)

This commit is contained in:
karwosts 2023-08-07 03:00:04 -07:00 committed by GitHub
parent 945c8e0320
commit 827a57499b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -227,7 +227,7 @@ export class DialogEnergyGasSettings
"ui.panel.config.energy.gas.dialog.cost_number_input"
)} ${unitPrice ? ` (${unitPrice})` : ""}`}
class="price-options"
step=".01"
step="any"
type="number"
.value=${this._source.number_energy_price}
@change=${this._numberPriceChanged}

View File

@ -96,10 +96,12 @@ export class DialogEnergyGridFlowSettings
const pickableUnit = this._energy_units?.join(", ") || "";
const unitPrice = this._pickedDisplayUnit
const unitPriceSensor = this._pickedDisplayUnit
? `${this.hass.config.currency}/${this._pickedDisplayUnit}`
: undefined;
const unitPriceFixed = `${this.hass.config.currency}/kWh`;
const externalSource =
this._source[
this._params.direction === "from"
@ -223,7 +225,7 @@ export class DialogEnergyGridFlowSettings
.value=${this._source.entity_energy_price}
.label=${`${this.hass.localize(
`ui.panel.config.energy.grid.flow_dialog.${this._params.direction}.cost_entity_input`
)} ${unitPrice ? ` (${unitPrice})` : ""}`}
)} ${unitPriceSensor ? ` (${unitPriceSensor})` : ""}`}
@value-changed=${this._priceEntityChanged}
></ha-entity-picker>`
: ""}
@ -244,12 +246,12 @@ export class DialogEnergyGridFlowSettings
? html`<ha-textfield
.label=${`${this.hass.localize(
`ui.panel.config.energy.grid.flow_dialog.${this._params.direction}.cost_number_input`
)} ${unitPrice ? ` (${unitPrice})` : ""}`}
)} (${unitPriceFixed})`}
class="price-options"
step=".01"
step="any"
type="number"
.value=${this._source.number_energy_price}
.suffix=${unitPrice || ""}
.suffix=${unitPriceFixed}
@change=${this._numberPriceChanged}
>
</ha-textfield>`