Some fixes for low carbon display (#14020)

This commit is contained in:
Paul Bottein 2022-10-10 16:21:02 +02:00 committed by GitHub
parent 3a41b4e65b
commit 05f2ef8a37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 15 deletions

View File

@ -85,10 +85,6 @@ class HuiEnergyCarbonGaugeCard
let value: number | undefined;
if (totalGridConsumption === 0) {
value = 100;
}
if (this._data.fossilEnergyConsumption && totalGridConsumption) {
const highCarbonEnergy = this._data.fossilEnergyConsumption
? Object.values(this._data.fossilEnergyConsumption).reduce(
@ -141,12 +137,12 @@ class HuiEnergyCarbonGaugeCard
></ha-gauge>
<div class="name">
${this.hass.localize(
"ui.panel.lovelace.cards.energy.carbon_consumed_gauge.non_fossil_energy_consumed"
"ui.panel.lovelace.cards.energy.carbon_consumed_gauge.low_carbon_energy_consumed"
)}
</div>
`
: html`${this.hass.localize(
"ui.panel.lovelace.cards.energy.carbon_consumed_gauge.non_fossil_energy_not_calculated"
"ui.panel.lovelace.cards.energy.carbon_consumed_gauge.low_carbon_energy_not_calculated"
)}`}
</ha-card>
`;

View File

@ -262,7 +262,7 @@ class HuiEnergyDistrubutionCard
: html`<div class="circle-container low-carbon">
<span class="label"
>${this.hass.localize(
"ui.panel.lovelace.cards.energy.energy_distribution.non_fossil"
"ui.panel.lovelace.cards.energy.energy_distribution.low_carbon"
)}</span
>
<a
@ -272,11 +272,9 @@ class HuiEnergyDistrubutionCard
rel="noopener no referrer"
>
<ha-svg-icon .path=${mdiLeaf}></ha-svg-icon>
${lowCarbonEnergy
? formatNumber(lowCarbonEnergy, this.hass.locale, {
maximumFractionDigits: 1,
})
: "—"}
${formatNumber(lowCarbonEnergy || 0, this.hass.locale, {
maximumFractionDigits: 1,
})}
kWh
</a>
<svg width="80" height="30">

View File

@ -3691,7 +3691,7 @@
"grid": "Grid",
"gas": "Gas",
"solar": "Solar",
"non_fossil": "Non-fossil",
"low_carbon": "Low-carbon",
"home": "Home",
"battery": "Battery",
"go_to_energy_dashboard": "Go to the energy dashboard"
@ -3702,8 +3702,8 @@
},
"carbon_consumed_gauge": {
"card_indicates_energy_used": "This card indicates how much of the energy consumed by your home was generated using non-fossil fuels like solar, wind and nuclear. The higher, the better!",
"non_fossil_energy_consumed": "Non-fossil energy consumed",
"non_fossil_energy_not_calculated": "Consumed non-fossil energy couldn't be calculated"
"low_carbon_energy_consumed": "Low-carbon energy consumed",
"low_carbon_energy_not_calculated": "Consumed low-carbon energy couldn't be calculated"
}
}
},