mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +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 = (
|
export const getReferencedStatisticIds = (
|
||||||
prefs: EnergyPreferences,
|
prefs: EnergyPreferences,
|
||||||
info: EnergyInfo,
|
info: EnergyInfo,
|
||||||
exclude?: string[]
|
includeTypes?: 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)) {
|
if (includeTypes && !includeTypes.includes(source.type)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.type === "solar") {
|
if (source.type === "solar") {
|
||||||
statIDs.push(source.stat_energy_from);
|
statIDs.push(source.stat_energy_from);
|
||||||
continue;
|
continue;
|
||||||
@ -288,6 +289,7 @@ export const getReferencedStatisticIds = (
|
|||||||
|
|
||||||
if (source.type === "gas" || source.type === "water") {
|
if (source.type === "gas" || source.type === "water") {
|
||||||
statIDs.push(source.stat_energy_from);
|
statIDs.push(source.stat_energy_from);
|
||||||
|
|
||||||
if (source.stat_cost) {
|
if (source.stat_cost) {
|
||||||
statIDs.push(source.stat_cost);
|
statIDs.push(source.stat_cost);
|
||||||
}
|
}
|
||||||
@ -366,7 +368,6 @@ const getEnergyData = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const waterStatIds: string[] = [];
|
|
||||||
const consumptionStatIDs: string[] = [];
|
const consumptionStatIDs: string[] = [];
|
||||||
for (const source of prefs.energy_sources) {
|
for (const source of prefs.energy_sources) {
|
||||||
// grid source
|
// grid source
|
||||||
@ -375,11 +376,14 @@ const getEnergyData = async (
|
|||||||
consumptionStatIDs.push(flowFrom.stat_energy_from);
|
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];
|
const allStatIDs = [...energyStatIds, ...waterStatIds];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user