fix: restrict blind direction reversal to 3D appearance
This commit is contained in:
1 parent
b9a095bc6e
commit
7a9b2c0a38
19 files changed
+721
-629
No files matched your search
@@ -179,9 +179,9 @@ try {
|
||||
await window.chooseControl(field("Lamellenposition"), 102, "Lamellen Position");
|
||||
await window.chooseControl(field("Positions-Sensor (live)"), 103, "Positionsrückmeldung");
|
||||
const check = (text) => [...e.shadowRoot.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes(text)).querySelector("input").click();
|
||||
check("Wirksinn Behang umkehren");
|
||||
check("Behang in 3D umkehren");
|
||||
await e.updateComplete;
|
||||
check("Wirksinn Lamellen umkehren");
|
||||
check("Lamellen in 3D umkehren");
|
||||
await e.updateComplete;
|
||||
await p.updateComplete;
|
||||
await e.updateComplete;
|
||||
@@ -204,8 +204,8 @@ try {
|
||||
const o = f.openings.find((o) => o.id === window.controlWindow);
|
||||
return [f.furniture.find((m) => m.id === window.controlLamp).entity, o.cover, o.cover_tilt, o.position, o.cover_inverted, o.cover_tilt_inverted];
|
||||
}), ["light.42", "cover.101", "cover.102", "cover.103", true, true], "native feedback selection and independent direction switches persist");
|
||||
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_position), 80, "display follows inverted 0-255 feedback rather than the command value");
|
||||
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_tilt_position), 100 - 128 / 255 * 100);
|
||||
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_position), 20, "display follows the unchanged 0-255 feedback despite reversed 3D direction");
|
||||
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_tilt_position), 128 / 255 * 100);
|
||||
await page.evaluate(async () => {
|
||||
window.logicalControlCalls = [];
|
||||
const send = window.controlHass.callService;
|
||||
@@ -230,10 +230,30 @@ try {
|
||||
await page.waitForFunction(() => window.actuatorCalls.length === 4);
|
||||
assert.deepEqual(await page.evaluate(() => window.actuatorCalls.map((c) => [c.domain, c.service, c.data])), [
|
||||
["light", "turn_on", { entity_id: "light.42", brightness_pct: 25 }],
|
||||
["cover", "set_cover_position", { entity_id: "cover.101", position: 40 }],
|
||||
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 70 }],
|
||||
["cover", "set_cover_position", { entity_id: "cover.101", position: 60 }],
|
||||
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 30 }],
|
||||
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 70 }],
|
||||
], JSON.stringify(await page.evaluate(() => window.logicalControlCalls)));
|
||||
await page.evaluate(async () => {
|
||||
const raw = window.nfPanel.hass;
|
||||
const states = { ...raw.states };
|
||||
for (const id of ["cover.101", "cover.102", "cover.103"]) states[id] = { ...states[id], state: "closed", attributes: { ...states[id].attributes, symcon_numeric_value: 0, current_position: 0, current_tilt_position: 0 } };
|
||||
const zero = window.SymconAdapter.withCoverControls({ ...raw, states }, window.ed._doc.floors);
|
||||
const panel = document.querySelector("#controls-room"), quick = document.querySelector("#controls-quick");
|
||||
panel.hass = quick.hass = zero;
|
||||
await panel.updateComplete;
|
||||
await quick.updateComplete;
|
||||
const row = [...panel.shadowRoot.querySelectorAll(".nf-rp-row")].find((r) => r.textContent.includes("Behang Position"));
|
||||
const sliders = [...row.querySelectorAll('input[type="range"]')];
|
||||
if (!sliders.every((input) => input.value === "0")) throw new Error("Reversed 3D settings changed a zero slider value");
|
||||
if (quick.shadowRoot.querySelector(".qm-blind b").textContent !== "0 %") throw new Error("Quick menu changed the zero reading");
|
||||
for (const input of sliders) input.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
});
|
||||
await page.waitForFunction(() => window.actuatorCalls.length === 6);
|
||||
assert.deepEqual(await page.evaluate(() => window.actuatorCalls.slice(4).map((c) => [c.service, c.data])), [
|
||||
["set_cover_position", { entity_id: "cover.101", position: 0 }],
|
||||
["set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 0 }],
|
||||
], "zero must be sent unchanged for both blind and slats");
|
||||
assert.equal(await page.evaluate(() => window.actuatorCalls.some((c) => c.data.entity_id === "cover.103")), false, "feedback is never written");
|
||||
await page.evaluate(async () => {
|
||||
const e = window.ed;
|
||||
@@ -245,9 +265,9 @@ try {
|
||||
const positionField = [...e.shadowRoot.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith("Positions-Sensor (live)"));
|
||||
await window.chooseControl(positionField.querySelector("nf-entity-picker"), 103, "Positionsrückmeldung");
|
||||
const check = (text) => [...e.shadowRoot.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes(text)).querySelector("input").click();
|
||||
check("Wirksinn Behang umkehren");
|
||||
check("Behang in 3D umkehren");
|
||||
await e.updateComplete;
|
||||
check("Wirksinn Lamellen umkehren");
|
||||
check("Lamellen in 3D umkehren");
|
||||
await e.updateComplete;
|
||||
});
|
||||
assert.equal(await page.evaluate(() => window.ed._doc.floors[0].placements.find((p) => p.entity_id === "cover.101").cover_tilt), "cover.102", "standalone blinds also expose the actual native slat picker");
|
||||
|
||||
Reference in new issue
Block a user