mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Minor fixes to energy sources behavior (#20785)
This commit is contained in:
parent
f5f2a5ad5b
commit
3ebe6027be
@ -47,7 +47,9 @@ export class EnergyViewStrategy extends ReactiveElement {
|
|||||||
view.type = "sidebar";
|
view.type = "sidebar";
|
||||||
|
|
||||||
const hasGrid = prefs.energy_sources.find(
|
const hasGrid = prefs.energy_sources.find(
|
||||||
(source) => source.type === "grid"
|
(source) =>
|
||||||
|
source.type === "grid" &&
|
||||||
|
(source.flow_from?.length || source.flow_to?.length)
|
||||||
) as GridSourceTypeEnergyPreference;
|
) as GridSourceTypeEnergyPreference;
|
||||||
const hasReturn = hasGrid && hasGrid.flow_to.length;
|
const hasReturn = hasGrid && hasGrid.flow_to.length;
|
||||||
const hasSolar = prefs.energy_sources.some(
|
const hasSolar = prefs.energy_sources.some(
|
||||||
@ -110,7 +112,7 @@ export class EnergyViewStrategy extends ReactiveElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasGrid || hasSolar) {
|
if (hasGrid || hasSolar || hasGas || hasWater) {
|
||||||
view.cards!.push({
|
view.cards!.push({
|
||||||
title: hass.localize(
|
title: hass.localize(
|
||||||
"ui.panel.energy.cards.energy_sources_table_title"
|
"ui.panel.energy.cards.energy_sources_table_title"
|
||||||
|
@ -694,7 +694,9 @@ export class HuiEnergySourcesTableCard
|
|||||||
</tr>`;
|
</tr>`;
|
||||||
})}`
|
})}`
|
||||||
)}
|
)}
|
||||||
${types.grid
|
${types.grid &&
|
||||||
|
(types.grid?.[0].flow_from?.length ||
|
||||||
|
types.grid?.[0].flow_to?.length)
|
||||||
? html` <tr class="mdc-data-table__row total">
|
? html` <tr class="mdc-data-table__row total">
|
||||||
<td class="mdc-data-table__cell"></td>
|
<td class="mdc-data-table__cell"></td>
|
||||||
<th class="mdc-data-table__cell" scope="row">
|
<th class="mdc-data-table__cell" scope="row">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user