feat: improve Symcon designer controls and KNX temperature selection

This commit is contained in:
jhartworks committed 2026-11-09 15:01:54 +01:00
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>`;
}