mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix water costs (#14263)
This commit is contained in:
parent
79c8b7dc27
commit
3cd64675df
@ -273,14 +273,15 @@ export interface EnergyData {
|
||||
export const getReferencedStatisticIds = (
|
||||
prefs: EnergyPreferences,
|
||||
info: EnergyInfo,
|
||||
exclude?: string[]
|
||||
includeTypes?: string[]
|
||||
): string[] => {
|
||||
const statIDs: string[] = [];
|
||||
|
||||
for (const source of prefs.energy_sources) {
|
||||
if (exclude?.includes(source.type)) {
|
||||
if (includeTypes && !includeTypes.includes(source.type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (source.type === "solar") {
|
||||
statIDs.push(source.stat_energy_from);
|
||||
continue;
|
||||
@ -288,6 +289,7 @@ export const getReferencedStatisticIds = (
|
||||
|
||||
if (source.type === "gas" || source.type === "water") {
|
||||
statIDs.push(source.stat_energy_from);
|
||||
|
||||
if (source.stat_cost) {
|
||||
statIDs.push(source.stat_cost);
|
||||
}
|
||||
@ -366,7 +368,6 @@ const getEnergyData = async (
|
||||
}
|
||||
}
|
||||
|
||||
const waterStatIds: string[] = [];
|
||||
const consumptionStatIDs: string[] = [];
|
||||
for (const source of prefs.energy_sources) {
|
||||
// grid source
|
||||
@ -375,11 +376,14 @@ const getEnergyData = async (
|
||||
consumptionStatIDs.push(flowFrom.stat_energy_from);
|
||||
}
|
||||
}
|
||||
if (source.type === "water") {
|
||||
waterStatIds.push(source.stat_energy_from);
|
||||
}
|
||||
}
|
||||
const energyStatIds = getReferencedStatisticIds(prefs, info, ["water"]);
|
||||
const energyStatIds = getReferencedStatisticIds(prefs, info, [
|
||||
"grid",
|
||||
"solar",
|
||||
"battery",
|
||||
"gas",
|
||||
]);
|
||||
const waterStatIds = getReferencedStatisticIds(prefs, info, ["water"]);
|
||||
|
||||
const allStatIDs = [...energyStatIds, ...waterStatIds];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user