mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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";
|
||||
|
||||
const hasGrid = prefs.energy_sources.find(
|
||||
(source) => source.type === "grid"
|
||||
(source) =>
|
||||
source.type === "grid" &&
|
||||
(source.flow_from?.length || source.flow_to?.length)
|
||||
) as GridSourceTypeEnergyPreference;
|
||||
const hasReturn = hasGrid && hasGrid.flow_to.length;
|
||||
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({
|
||||
title: hass.localize(
|
||||
"ui.panel.energy.cards.energy_sources_table_title"
|
||||
|
@ -694,7 +694,9 @@ export class HuiEnergySourcesTableCard
|
||||
</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">
|
||||
<td class="mdc-data-table__cell"></td>
|
||||
<th class="mdc-data-table__cell" scope="row">
|
||||
|
Loading…
x
Reference in New Issue
Block a user