fix: show incomplete Symcon utility sums with Err prefix
This commit is contained in:
1 parent
a804fc8e15
commit
bb153490b0
14 files changed
+361
-293
No files matched your search
@@ -52,7 +52,7 @@ import { fixtureGlow } from "../entities/kinds.ts";
|
||||
import { coverTiltEntity } from "../entities/covers.ts";
|
||||
import { isSymcon, isSymconVariable, nativeBool, nativeText } from "../entities/symcon-values.ts";
|
||||
import { WEATHER_VARIABLE_LABELS } from "../symcon-weather.ts";
|
||||
import { floorUtilityReadings } from "../utilities.ts";
|
||||
import { floorUtilityReadings, utilityText } from "../utilities.ts";
|
||||
import "./utility-report.ts";
|
||||
import { deviceValuesText } from "../entities/device-values.ts";
|
||||
import { furnitureShown, hiddenFurniture, withoutHidden } from "../entities/visibility.ts";
|
||||
@@ -2600,10 +2600,11 @@ export class NfView3d extends LitElement {
|
||||
const hass = this.hass;
|
||||
const rows: { icon: string; label: string; value: string }[] = [];
|
||||
const floor = this.floorId ? b.floors.find((f) => f.id === this.floorId) : undefined;
|
||||
const floorPower = floor && isSymcon(hass) ? floorUtilityReadings(hass, floor, b.floors.flatMap((f) => f.rooms)).find((r) => r.kind === "electricity" && r.metric === "power" && r.unit === "W")?.value ?? null : floor?.power_entity ? readPower(hass?.states[floor.power_entity]) : null;
|
||||
if (floor && floorPower !== null) {
|
||||
const share = consumption && consumption > 0 ? ` · ${translate(hass, "floor_power_share", { n: Math.round((Math.max(0, floorPower) / consumption) * 100) })}` : "";
|
||||
rows.push({ icon: "⚡", label: floor.name, value: `${powerText(hass, floorPower)}${share}` });
|
||||
const meter = floor && isSymcon(hass) ? floorUtilityReadings(hass, floor, b.floors.flatMap((f) => f.rooms)).find((r) => r.kind === "electricity" && r.metric === "power" && r.unit === "W") : undefined;
|
||||
const floorPower = isSymcon(hass) ? meter?.value ?? null : floor?.power_entity ? readPower(hass?.states[floor.power_entity]) : null;
|
||||
if (floor && (meter || floorPower !== null)) {
|
||||
const share = !meter?.incomplete && floorPower !== null && consumption && consumption > 0 ? ` · ${translate(hass, "floor_power_share", { n: Math.round((Math.max(0, floorPower) / consumption) * 100) })}` : "";
|
||||
rows.push({ icon: "⚡", label: floor.name, value: `${meter ? utilityText(hass, meter) : powerText(hass, floorPower!)}${share}` });
|
||||
}
|
||||
for (const [key, icon, label] of [["gas", "🔥", "energy_gas_short"], ["water", "💧", "energy_water_short"]] as const) {
|
||||
const id = b.energy[key];
|
||||
|
||||
Reference in new issue
Block a user