feat: add floating power cards for all powered furniture

This commit is contained in:
jhartworks committed 2026-11-11 16:24:52 +01:00
1 parent 6bd3598779
commit 4967dd7950
19 files changed
+1125 -810

No files matched your search

+6 -2
View File
@@ -31,6 +31,7 @@ import { weatherEntity } from "../weather.ts";
import { chosenEffects, readSkyWeather, withDensity } from "../live/sky-weather.ts";
import { energyPicture, houseHub, type EnergyPicture } from "../live/energy-flow.ts";
import { roomClimateCards } from "../live/room-climate-card.ts";
import { furniturePowerCards } from "../live/furniture-power-card.ts";
import { loadWeek, type WeekBars } from "../live/week-bars.ts";
import { binsDue, loadToday, sortDay, type TodayItem } from "../live/today.ts";
import { forecastDays, loadForecast } from "../live/forecast.ts";
@@ -2659,7 +2660,10 @@ export class NfView3d extends LitElement {
for (const p of this.liveHeatPumps(b)) cards.push({ kind: "heatpump", at: p.at, name: p.name, pump: p.pump });
for (const m of media) cards.push({ kind: "media", at: { ...m.at, y: m.at.y + 0.5 }, media: m });
}
if (this.liveCardsOn && !this.dimmed) cards.push(...roomClimateCards(hass, b, this.floorId, this.roomId));
if (this.liveCardsOn && !this.dimmed) {
cards.push(...roomClimateCards(hass, b, this.floorId, this.roomId));
cards.push(...furniturePowerCards(hass, b, this.furnitureLinks ?? new Map(), this.floorId, this.roomId));
}
if (JSON.stringify(cards) !== JSON.stringify(this._liveCards)) this._liveCards = cards;
v.setLiveAnchors(
cards.map((c) => c.at),
@@ -2710,7 +2714,7 @@ export class NfView3d extends LitElement {
const own = this.ownSensors();
const e = this._liveEnergy?.summary;
const energy = !!e && !this.roomId && this.showEnergy && !!this.hass && !(e.consumption === null && e.grid === null && e.solar === null && e.battery === null);
const climate = this.building?.floors.some((f) => f.rooms.some((r) => r.climate_card));
const climate = this.building?.floors.some((f) => f.rooms.some((r) => r.climate_card) || f.furniture.some((m) => m.power_card));
const climateToggle = climate ? this.renderCardToggle() : nothing;
const roomNames = this.roomNamesButton ? html`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${translate(this.hass, "room_names_toggle_hint")} @click=${() => {
this.roomLabels = !this.roomLabels;