mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
Fix water costs
This commit is contained in:
parent
c7cb8cf762
commit
3590ad0672
@ -273,21 +273,23 @@ export interface EnergyData {
|
|||||||
export const getReferencedStatisticIds = (
|
export const getReferencedStatisticIds = (
|
||||||
prefs: EnergyPreferences,
|
prefs: EnergyPreferences,
|
||||||
info: EnergyInfo,
|
info: EnergyInfo,
|
||||||
exclude?: string[]
|
excludeEnergyStatTypes?: string[]
|
||||||
): string[] => {
|
): string[] => {
|
||||||
const statIDs: string[] = [];
|
const statIDs: string[] = [];
|
||||||
|
|
||||||
for (const source of prefs.energy_sources) {
|
for (const source of prefs.energy_sources) {
|
||||||
if (exclude?.includes(source.type)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (source.type === "solar") {
|
if (source.type === "solar") {
|
||||||
statIDs.push(source.stat_energy_from);
|
if (!excludeEnergyStatTypes?.includes(source.type)) {
|
||||||
|
statIDs.push(source.stat_energy_from);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.type === "gas" || source.type === "water") {
|
if (source.type === "gas" || source.type === "water") {
|
||||||
statIDs.push(source.stat_energy_from);
|
if (!excludeEnergyStatTypes?.includes(source.type)) {
|
||||||
|
statIDs.push(source.stat_energy_from);
|
||||||
|
}
|
||||||
|
|
||||||
if (source.stat_cost) {
|
if (source.stat_cost) {
|
||||||
statIDs.push(source.stat_cost);
|
statIDs.push(source.stat_cost);
|
||||||
}
|
}
|
||||||
@ -299,14 +301,18 @@ export const getReferencedStatisticIds = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (source.type === "battery") {
|
if (source.type === "battery") {
|
||||||
statIDs.push(source.stat_energy_from);
|
if (!excludeEnergyStatTypes?.includes(source.type)) {
|
||||||
statIDs.push(source.stat_energy_to);
|
statIDs.push(source.stat_energy_from);
|
||||||
|
statIDs.push(source.stat_energy_to);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// grid source
|
// grid source
|
||||||
for (const flowFrom of source.flow_from) {
|
for (const flowFrom of source.flow_from) {
|
||||||
statIDs.push(flowFrom.stat_energy_from);
|
if (!excludeEnergyStatTypes?.includes(source.type)) {
|
||||||
|
statIDs.push(flowFrom.stat_energy_from);
|
||||||
|
}
|
||||||
if (flowFrom.stat_cost) {
|
if (flowFrom.stat_cost) {
|
||||||
statIDs.push(flowFrom.stat_cost);
|
statIDs.push(flowFrom.stat_cost);
|
||||||
}
|
}
|
||||||
@ -316,7 +322,9 @@ export const getReferencedStatisticIds = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const flowTo of source.flow_to) {
|
for (const flowTo of source.flow_to) {
|
||||||
statIDs.push(flowTo.stat_energy_to);
|
if (!excludeEnergyStatTypes?.includes(source.type)) {
|
||||||
|
statIDs.push(flowTo.stat_energy_to);
|
||||||
|
}
|
||||||
if (flowTo.stat_compensation) {
|
if (flowTo.stat_compensation) {
|
||||||
statIDs.push(flowTo.stat_compensation);
|
statIDs.push(flowTo.stat_compensation);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user