fix: select native variables by datatype and explain rejected links

This commit is contained in:
jhartworks committed 2026-11-12 10:14:19 +01:00
1 parent 4967dd7950
commit 8c6b23bd22
29 files changed
+2031 -1790

No files matched your search

+15 -1
View File
@@ -14,5 +14,19 @@ test("integer dimmers, normalized floats and separate blind variables preserve t
assert.equal(symconControl(fraction, "light")!.attributes.brightness, 102);
assert.equal(symconControl(fraction, "cover")!.attributes.current_position, 40);
assert.equal(symconPercent(entity("sensor.low", "10", { symcon_numeric_value: 10, symcon_min: 10, symcon_max: 110 })), 0);
assert.equal(symconControl(entity("switch.8", "on", { symcon_id: 8, symcon_variable_type: 0 }), "light"), null, "a boolean switch cannot pretend to dim");
const toggle = symconControl(entity("switch.8", "on", { symcon_id: 8, symcon_variable_type: 0 }), "light")!;
assert.deepEqual(toggle.attributes.supported_color_modes, ["onoff"], "a boolean can switch a light but cannot pretend to dim");
assert.equal(toggle.attributes.brightness, undefined);
});
test("Boolean lights use their raw value even when names previously classified them as a garage door or lock", () => {
for (const domain of ["cover", "lock", "binary_sensor", "switch", "sensor"]) {
const st = entity(`${domain}.57755`, "locked", { symcon_id: 57755, symcon_variable_type: 0, symcon_value: false });
assert.equal(symconControl(st, "light")!.state, "off");
st.attributes.symcon_value = true;
assert.equal(symconControl(st, "light")!.state, "on");
st.state = "unavailable";
assert.equal(symconControl(st, "light")!.state, "unavailable");
assert.equal(symconControl(st, "cover"), null, "a boolean is not a numeric blind position");
}
});