fix: support Symcon numeric dimmers and independent blind slat controls

This commit is contained in:
jhartworks committed 2026-11-09 15:24:59 +01:00
1 parent b934f78b9a
commit 24188f96f7
36 files changed
+1105 -683

No files matched your search

+15 -2
View File
@@ -1,10 +1,23 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { entity, hassOf } from "./fixtures.ts";
import { coverPosition, coverReaches } from "./covers.ts";
import { box, entity, floorWith, hassOf, opening } from "./fixtures.ts";
import { coverPosition, coverReaches, coverTiltEntity, coverWithTilt } from "./covers.ts";
import { emptyBuilding, newFloor, type Furniture } from "../model.ts";
import { setPacks, type PackItem } from "../packs.ts";
test("separate slat sources are resolved per blind and enrich only its control state", () => {
const hass = hassOf([entity("cover.height", "open", { current_position: 40, supported_features: 4 }), entity("cover.slats", "open", { current_position: 75 })]);
const floor = floorWith([box("r", 0, 0, 4, 4)], { openings: [opening("w", "r", "window", { cover: "cover.height", cover_tilt: "cover.slats" })] });
assert.equal(coverTiltEntity(hass, [floor], "cover.height"), "cover.slats");
const state = coverWithTilt(hass, hass.states["cover.height"], "cover.slats");
assert.equal(state.attributes.current_position, 40);
assert.equal(state.attributes.current_tilt_position, 75);
assert.equal(state.attributes.supported_features, 132);
assert.equal(hass.states["cover.height"].attributes.current_tilt_position, undefined, "one opening's mapping must not mutate a shared source");
const placed = floorWith([], { placements: [{ entity_id: "cover.height", cover_tilt: "cover.slats", x: 1, z: 1, y: null }] });
assert.equal(coverTiltEntity(hass, [placed], "cover.height"), "cover.slats", "standalone placed blinds also support a separate slat variable");
});
test("a cover's position comes from its attribute, else from open / closed", () => {
const hass = hassOf([
entity("cover.a", "open", { current_position: 40 }),