feat: improve Symcon controls, device readings and designer help
This commit is contained in:
1 parent
ff54f4461a
commit
00fca890de
50 files changed
+2447
-1840
No files matched your search
@@ -50,6 +50,7 @@ import { scaleGlow, buildMarkers, openMoreInfo, stateText, toggleEntity, withPlu
|
||||
import { fanSpin } from "../entities/fans.ts";
|
||||
import { fixtureGlow } from "../entities/kinds.ts";
|
||||
import { coverTiltEntity } from "../entities/covers.ts";
|
||||
import { deviceValuesText } from "../entities/device-values.ts";
|
||||
import { furnitureShown, hiddenFurniture, withoutHidden } from "../entities/visibility.ts";
|
||||
import { pictureUrl } from "../entities/pictures.ts";
|
||||
import { fetchImage } from "../api.ts";
|
||||
@@ -1236,7 +1237,7 @@ export class NfView3d extends LitElement {
|
||||
const deviceTemp = !isCooling(f.type) ? deviceTempOf(hass, f.temp_entity) : null;
|
||||
const deviceTempText = deviceTemp === null ? "" : `🌡 ${formatNumber(hass, fromCelsius(hass, deviceTemp), 1)} ${tempUnit(hass)}`;
|
||||
const extraRef = f.type === "home_battery" ? f.soc : f.type === "wallbox" ? f.status : temps ? (f.temp_entity && f.temp_entity !== "none" ? f.temp_entity : f.temp_entity2) : deviceTemp !== null ? f.temp_entity : null;
|
||||
const extra = extraRef && extraRef !== "none" ? extraRef : null;
|
||||
const extra = extraRef && extraRef !== "none" ? extraRef : (f.values ?? []).find((v) => v.entity && v.entity !== "none")?.entity ?? null;
|
||||
const link = linked ?? (extra ? { entity: null, power: null } : undefined);
|
||||
if (!link) continue;
|
||||
// a battery goes by its charge first: its power sensor is often placed on its own as well
|
||||
@@ -1330,6 +1331,7 @@ export class NfView3d extends LitElement {
|
||||
? formatPower(hass, Math.max(0, power))
|
||||
: "",
|
||||
deviceTempText,
|
||||
deviceValuesText(hass, f.values),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · "),
|
||||
@@ -1341,7 +1343,7 @@ export class NfView3d extends LitElement {
|
||||
// inverter, battery, wallbox: their own text (watts, charge, status) is always worth a pin
|
||||
energyDevice: f.type === "inverter" || f.type === "home_battery" || f.type === "wallbox" || f.type === "meter",
|
||||
// a fridge's temperatures are worth a pin, like an energy device's values
|
||||
readout: !!temps || undefined,
|
||||
readout: !!temps || !!f.values?.some((v) => v.entity && v.entity !== "none") || undefined,
|
||||
show: f.marker ?? undefined,
|
||||
fromFurniture: true,
|
||||
});
|
||||
@@ -1563,7 +1565,7 @@ export class NfView3d extends LitElement {
|
||||
}
|
||||
|
||||
/** A lamp: its 3D model glows with the linked light and is tapped directly. */
|
||||
private lampMarker(hass: HomeAssistant, floor: Building["floors"][number], f: Furniture, entity: string | null): DeviceMarker & { fromFurniture: boolean } {
|
||||
private lampMarker(hass: HomeAssistant, floor: Building["floors"][number], f: Furniture, entity: string | null): DeviceMarker & { fromFurniture: boolean; readout?: boolean } {
|
||||
const st = entity ? hass.states[entity] : undefined;
|
||||
// further bulbs of the same fixture (a night light, an ambient ring): the lamp glows with them while its main light is off
|
||||
const others = (f.extra_lights ?? []).map((id) => hass.states[id]).filter((s): s is HassEntity => !!s);
|
||||
@@ -1607,7 +1609,7 @@ export class NfView3d extends LitElement {
|
||||
bollard: base + f.h + 0.25,
|
||||
garden: base + f.h + 0.25,
|
||||
}[model];
|
||||
const marker: DeviceMarker & { fromFurniture: boolean } = {
|
||||
const marker: DeviceMarker & { fromFurniture: boolean; readout?: boolean } = {
|
||||
// a lamp without a light keeps a key of its own (it is drawn, but not tappable)
|
||||
id: entity ?? `lamp:${f.id}`,
|
||||
floorId: floor.id,
|
||||
@@ -1617,7 +1619,8 @@ export class NfView3d extends LitElement {
|
||||
y,
|
||||
icon: iconSvg("light"),
|
||||
name: f.name || (entity ? entityName(hass, entity) : furnitureName(hass, f.type)),
|
||||
text: st && (isActive(st) || !otherOn) ? stateText(hass, st) : otherOn ? entityName(hass, otherOn.entity_id) : "",
|
||||
text: [st && (isActive(st) || !otherOn) ? stateText(hass, st) : otherOn ? entityName(hass, otherOn.entity_id) : "", deviceValuesText(hass, f.values)].filter(Boolean).join(" · "),
|
||||
readout: !!f.values?.some((v) => v.entity && v.entity !== "none"),
|
||||
active: (st ? isActive(st) : false) || !!otherOn,
|
||||
unavailable: st ? isUnavailable(st) : false,
|
||||
glow: st || others.length ? scaleGlow(fixtureGlow(st, others, f.color_entity && f.color_entity !== "none" ? hass.states[f.color_entity] : undefined), f.glow_scale) : null,
|
||||
|
||||
Reference in new issue
Block a user