mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 16:38: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:
@@ -309,3 +309,15 @@ export function areaLights(hass: any, devices: { area: string; entities: string[
|
||||
}
|
||||
return seen ? 'off' : 'none';
|
||||
}
|
||||
|
||||
/** Average temperature across the area's devices (null when nothing reports one). */
|
||||
export function areaTemp(hass: any, devices: { area: string; entities: string[] }[], area: string): number | null {
|
||||
const vals: number[] = [];
|
||||
for (const d of devices) {
|
||||
if (d.area !== area) continue;
|
||||
const t = tempFor(hass, d.entities);
|
||||
if (t != null) vals.push(t);
|
||||
}
|
||||
if (!vals.length) return null;
|
||||
return Math.round((vals.reduce((a, b) => a + b, 0) / vals.length) * 10) / 10;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user