Show weather compensation summary banner on the Dashboard

New lib/ac-template.js factors the "which occupied AC template applies
right now" resolution out of scheduler.js (dedupes the tier-pick loop
that used to live separately in scheduler.js and status.js) into a
shared resolveOccupiedAcTier()/resolveGlobalOccupiedAcTemplate() pair.
GET /api/status now returns active_ac_template alongside weather_peak_c.

Dashboard shows a small banner above the zone grid: "Forecast high
today: XC" + "Aircon default: ON, 20C, High fan — Warm tier" — so staff
don't have to visit Settings to see what today's weather tier resolved
to.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-08-25 11:42:01 +00:00
parent e7a8153990
commit 5fc576aabd
6 changed files with 88 additions and 32 deletions

View file

@ -1,6 +1,6 @@
import type {
Zone, ZoneStatus, Device, DevicePhoto, ActivityEntry, NewbookSite, AppConfig,
MhiGateway, MhiStatus,
MhiGateway, MhiStatus, ActiveAcTemplate,
} from './types'
const BASE = '/hvac/api'
@ -46,7 +46,13 @@ export function syncZonesFromNewbook(): Promise<{ ok: boolean; created: number;
}
// Status / activity
export function fetchStatus(): Promise<{ mqtt_connected: boolean; weather_peak_c: number | null; weather_tier: string | null; zones: ZoneStatus[] }> {
export function fetchStatus(): Promise<{
mqtt_connected: boolean
weather_peak_c: number | null
weather_tier: string | null
active_ac_template: ActiveAcTemplate
zones: ZoneStatus[]
}> {
return request('/status')
}
export function fetchActivity(zoneId?: number, limit = 100): Promise<ActivityEntry[]> {