feat: show scoped utility overviews and compact trend controls

This commit is contained in:
jhartworks committed 2026-11-11 12:33:54 +01:00
1 parent 2bf5f4a60a
commit 5fd674bb00
17 files changed
+987 -456

No files matched your search

+7
View File
@@ -139,6 +139,13 @@ export function floorUtilityReadings(hass: HomeAssistant, floor: Floor, rooms: r
return result;
}
/** Sum the effective floor meters; shared native sources count only once for the building. */
export function buildingUtilityReadings(hass: HomeAssistant, floors: readonly Floor[]): UtilityReading[] {
const rooms = floors.flatMap((f) => f.rooms);
const sources = floors.flatMap((f) => floorUtilityReadings(hass, f, rooms).flatMap((r) => r.sources.map((id) => ({ kind: r.kind, metric: r.metric, period: r.period, id }))));
return readings(hass, sources);
}
export function utilityWatched(hass: HomeAssistant, floors: readonly Floor[]): string[] {
const rooms = floors.flatMap((f) => f.rooms);
return [...new Set(floors.flatMap((f) => [