mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 16:38:31 +00:00
feat v1.36.0: marker controls — wall switches that really switch
- marker.controls[]: bound light.*/switch.* entities; explicit per-marker tap_action=toggle flips them with HA-group semantics in one call (controlsAction + isControllable pure helpers, +2 unit tests, 100) - icon state and RGB tint mirror the targets (stateless remotes and virtual dumb-switch markers finally show something); info card lists targets with states; locks filtered everywhere - chips+search UI in the marker dialog; backend schema; smoke_controls (9 checks); TESTING/CHANGELOG same-commit
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
fitView, declump, safeUrl, resolveTapAction, floorsOf, subst, spaceDisplayOf, roomFillColor,
|
||||
splitRoomPath, polyContainsPoly, islandsOf,
|
||||
kelvinToRgb, glowColorOf, doorSector, hasRoomBehind,
|
||||
controlsAction, isControllable,
|
||||
segmentCm, formatLength, roomEdges, roomPoly, pointOnBoundary, pointStrictlyInside, roomsOverlap,
|
||||
mergeRooms, splitRoom, polygonArea, closestPointOnBoundary, isActiveState, snapToWall, openingAmount, fillColorsOf, lerpColor, roomFillStyle, stateIcon, lightColorOf, isAlarmState, parseRoomRef, diffNewDevices,
|
||||
} from '../test-build/logic.js';
|
||||
@@ -649,3 +650,19 @@ test('hasRoomBehind: neighbour room yes, street no', () => {
|
||||
assert.ok(!hasRoomBehind([10, 0], 90, [5, 0], [], 1));
|
||||
assert.ok(!hasRoomBehind([10, 0], 90, [5, 0], [[[30, 30], [40, 30], [40, 40], [30, 40]]], 1));
|
||||
});
|
||||
|
||||
test('controlsAction: HA-group semantics', () => {
|
||||
assert.equal(controlsAction(['off', 'off']), 'turn_on');
|
||||
assert.equal(controlsAction(['off', 'on']), 'turn_off');
|
||||
assert.equal(controlsAction(['on', 'on']), 'turn_off');
|
||||
assert.equal(controlsAction([undefined, 'off']), 'turn_on');
|
||||
assert.equal(controlsAction([]), 'turn_on');
|
||||
});
|
||||
|
||||
test('isControllable: lights and switches only', () => {
|
||||
assert.ok(isControllable('light.kitchen'));
|
||||
assert.ok(isControllable('switch.pump'));
|
||||
assert.ok(!isControllable('lock.front'));
|
||||
assert.ok(!isControllable('cover.gate'));
|
||||
assert.ok(!isControllable('alarm_control_panel.home'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user