mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 08:28:31 +00:00
feat v1.15.0: temperature room fill (blue/green/yellow) with editable comfort bounds
- fill_mode 'temp': below comfort → #4fc3f7, inside → #66d17a, above → #ffd45c; bounds default 20-25°C, editable in the space dialog (visible only for this mode), swapped bounds tolerated; rooms without a temperature reading unfilled - areaTemp(): average of the area devices' temperatures - tests: roomFillColor temp bands + bounds, spaceDisplayOf defaults, areaTemp, backend schema (fill_mode temp + temp_min/temp_max); smoke_temp_fill.mjs - TESTING.md updated in the same commit (policy)
This commit is contained in:
@@ -239,3 +239,22 @@ test('roomFillColor: lqi gradient, light tri-state, none', () => {
|
||||
assert.equal(roomFillColor('light', null, 'off'), '#9aa0a6');
|
||||
assert.equal(roomFillColor('light', null, 'none'), null);
|
||||
});
|
||||
|
||||
test('roomFillColor temp: blue/green/yellow bands, swapped bounds tolerated, no reading → no fill', () => {
|
||||
assert.equal(roomFillColor('temp', null, 'none', 18, 20, 25), '#4fc3f7'); // cold
|
||||
assert.equal(roomFillColor('temp', null, 'none', 20, 20, 25), '#66d17a'); // lower bound inclusive
|
||||
assert.equal(roomFillColor('temp', null, 'none', 25, 20, 25), '#66d17a'); // upper bound inclusive
|
||||
assert.equal(roomFillColor('temp', null, 'none', 26.5, 20, 25), '#ffd45c'); // hot
|
||||
assert.equal(roomFillColor('temp', null, 'none', 18, 25, 20), '#4fc3f7'); // swapped bounds
|
||||
assert.equal(roomFillColor('temp', null, 'none', null, 20, 25), null);
|
||||
assert.equal(roomFillColor('temp', null, 'none', undefined, 20, 25), null);
|
||||
});
|
||||
|
||||
test('spaceDisplayOf: temp bounds default to 20..25 and accept overrides', () => {
|
||||
const d = spaceDisplayOf({ plan_url: '/x.svg' });
|
||||
assert.equal(d.tempMin, 20);
|
||||
assert.equal(d.tempMax, 25);
|
||||
const o = spaceDisplayOf({ settings: { temp_min: 18.5, temp_max: 23 } });
|
||||
assert.equal(o.tempMin, 18.5);
|
||||
assert.equal(o.tempMax, 23);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user