fix: show incomplete Symcon utility sums with Err prefix

This commit is contained in:
jhartworks committed 2026-11-11 10:08:20 +01:00
1 parent a804fc8e15
commit bb153490b0
14 files changed
+361 -293

No files matched your search

+5 -3
View File
@@ -11,7 +11,7 @@ import { canAnnounce, roomHasSpeaker } from "../live/announce.ts";
import { isSymcon, nativeText } from "../entities/symcon-values.ts";
import "./room-hvac.ts";
import "./utility-report.ts";
import { roomUtilityReadings } from "../utilities.ts";
import { roomUtilityReadings, utilityText } from "../utilities.ts";
import type { Building, Floor, LightMood, LightSetting, Room } from "../model.ts";
import { roomPower, roomPowerSensors } from "../heatmap.ts";
import { energyCost, loadRoomEnergy, type RoomEnergy } from "../live/room-energy.ts";
@@ -586,8 +586,10 @@ export class NfRoomPanel extends LitElement {
const lux = roomClimateValue(this.hass, this.floor ?? null, room, "illuminance");
if (lux !== null) out.push(`☀ ${formatNumber(this.hass, lux, 0)} lx`);
// what the room's devices draw now
const power = this.floor && this.building ? roomPower(this.hass, this.building, this.floor, room) : null;
if (power !== null) out.push(`⚡ ${powerText(this.hass, power)}`);
const meter = roomUtilityReadings(this.hass, room, this.building?.floors.flatMap((f) => f.rooms)).find((r) => r.kind === "electricity" && r.metric === "power" && r.unit === "W");
const power = !meter && this.floor && this.building ? roomPower(this.hass, this.building, this.floor, room) : null;
if (meter) out.push(`⚡ ${utilityText(this.hass, meter)}`);
else if (power !== null) out.push(`⚡ ${powerText(this.hass, power)}`);
// how long its windows and doors stand open (the one open longest)
const openSince = this.floor
? this.floor.openings