mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 08:28:31 +00:00
fix v1.36.1: hidden grouped lamps toggle the lamp, not the DND switch
- primaryEntity: tiered selection, domain priority beats hidden flag (hidden light > visible config switch); visible same-domain still wins - live-debugged on the real install: individual lamps hidden in the registry (light group setup) got switch.*_do_not_disturb / identify buttons as primary — tap toggle 'did nothing' - +1 unit test (101); TESTING/CHANGELOG same-commit
This commit is contained in:
@@ -309,3 +309,24 @@ test('areaHum: averages climate sensors only, integer %', () => {
|
||||
assert.equal(areaHum(hass, devs, 'living'), 44);
|
||||
assert.equal(areaHum(hass, devs, 'nothing'), null);
|
||||
});
|
||||
|
||||
test('primaryEntity: hidden light beats visible config switch (grouped lamps)', () => {
|
||||
const hass = {
|
||||
entities: {
|
||||
'light.lamp': { hidden: true },
|
||||
'switch.lamp_do_not_disturb': { entity_category: 'config' },
|
||||
'button.lamp_identify': { entity_category: 'diagnostic' },
|
||||
},
|
||||
states: {},
|
||||
};
|
||||
assert.equal(
|
||||
primaryEntity(hass, ['switch.lamp_do_not_disturb', 'light.lamp', 'button.lamp_identify'], 'mdi:lightbulb'),
|
||||
'light.lamp',
|
||||
);
|
||||
// видимая сущность того же домена всё равно приоритетнее скрытой
|
||||
const hass2 = {
|
||||
entities: { 'light.a': { hidden: true }, 'light.b': {} },
|
||||
states: {},
|
||||
};
|
||||
assert.equal(primaryEntity(hass2, ['light.a', 'light.b'], 'mdi:lightbulb'), 'light.b');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user