feat: improve Symcon designer controls and KNX temperature selection
This commit is contained in:
1 parent
804f2d0494
commit
b934f78b9a
24 files changed
+908
-562
No files matched your search
@@ -1,10 +1,10 @@
|
||||
// The device list of a room: the entities of its area to place, the rows with their pins, and the room's climate sensors.
|
||||
|
||||
import { html, nothing, type TemplateResult } from "lit";
|
||||
import { CLIMATE_CLASSES, entityAreaId, entityKind, entityName, groupByDevice, isPlaceable, isRoomClimateSensor, kindOf, otherAreaEntities, roomClimateSensors, unassignedEntities, type ClimateKey, roomEntities } from "../../../devices.ts";
|
||||
import { entityAreaId, entityKind, entityName, groupByDevice, isClimateValueSensor, isPlaceable, isRoomClimateSensor, kindOf, otherAreaEntities, roomClimateSensors, unassignedEntities, type ClimateKey, roomEntities } from "../../../devices.ts";
|
||||
import { iconPath } from "../../../icons.ts";
|
||||
import { pointInPolygon, type Room } from "../../../model.ts";
|
||||
import { entityOptions, isNumeric } from "../entities.ts";
|
||||
import { entityOptions } from "../entities.ts";
|
||||
import { deviceIcon, entityField, hint } from "../fields.ts";
|
||||
import type { EditorHost } from "../host.ts";
|
||||
import { matchesQuery, placedElsewhere, placedInRoom, rankedBy, takeFirst, withToggled } from "../ops/device-list.ts";
|
||||
@@ -133,7 +133,7 @@ export function renderRoomClimate(host: EditorHost, room: Room, patch: (patch: P
|
||||
};
|
||||
const field = (key: ClimateKey, label: string) => {
|
||||
const found = roomClimateSensors(hass, host.floor ?? null, { ...room, climate: null }, key);
|
||||
const wanted = entityOptions(hass, (id) => isNumeric(id) && hass.states[id]?.attributes.device_class === CLIMATE_CLASSES[key]);
|
||||
const wanted = entityOptions(hass, (id) => isClimateValueSensor(hass, id, key));
|
||||
// the room's own sensors first, then the others; device temperatures (a printer, a heat pump) come last
|
||||
const options = rankedBy(wanted, (id) => (entityAreaId(hass, id) === room.area_id ? 0 : 1) + (isRoomClimateSensor(hass, id) ? 0 : 2));
|
||||
const picked = [room.climate?.[key] ?? null].flat();
|
||||
|
||||
@@ -96,8 +96,8 @@ export function renderEdgeHeights(host: EditorHost, room: Room, actions: EdgeAct
|
||||
</div>`;
|
||||
});
|
||||
};
|
||||
return html`<div class="nf-edge-box">
|
||||
<h4>${t("wall_heights")}</h4>
|
||||
return html`<details class="nf-edge-box">
|
||||
<summary>${t("wall_heights")}</summary>
|
||||
${room.points.flatMap((_, edge) => rowsOf(edge))} ${hint(t("room_wall_hint"))}
|
||||
</div>`;
|
||||
</details>`;
|
||||
}
|
||||
@@ -982,13 +982,17 @@ export const editorStyles = css`
|
||||
border-radius: 12px;
|
||||
background: color-mix(in srgb, var(--nf-accent) 6%, transparent);
|
||||
}
|
||||
.nf-edge-box h4 {
|
||||
margin: 0 0 4px;
|
||||
.nf-edge-box > summary {
|
||||
cursor: pointer;
|
||||
color: var(--nf-accent);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.nf-edge-box[open] > summary {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
/* a wall row: name and length, the height, then the buttons (full height, no wall, cut) in one line;
|
||||
a split point gets a line of its own below */
|
||||
.nf-edge-height {
|
||||
|
||||
Reference in new issue
Block a user