Compare commits

...

3 Commits

Author SHA1 Message Date
Bram Kragten
305fed2f55 Bumped version to 20221102.1 2022-11-02 19:10:06 +01:00
Bram Kragten
bac53bf288 Make it include instead of exclude 2022-11-02 18:42:11 +01:00
Bram Kragten
3590ad0672 Fix water costs 2022-11-02 18:18:51 +01:00
2 changed files with 12 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20221102.0" version = "20221102.1"
license = {text = "Apache-2.0"} license = {text = "Apache-2.0"}
description = "The Home Assistant frontend" description = "The Home Assistant frontend"
readme = "README.md" readme = "README.md"

View File

@@ -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];