Add weather compensation tiers for occupied aircon defaults
Warm/hot/heatwave tiers (ascending peak_above_c thresholds) override the global ac_occupied template when today's forecast peak clears one, picked once at the occupied-state transition so a guest's later manual adjustment is never stomped. New lib/weather.js fetches the peak via Met Office DataHub (if configured in settings) or Open-Meteo (no key needed) as a fallback, TTL-cached with a stale-fallback window on fetch failure. Zone-level per-field overrides still apply on top of a picked tier. Thresholds/templates live in hvac_defaults.ac_occupied_tiers (existing JSONB config blob, no migration) and are editable on the Settings page's new Weather Compensation table. Hotel lat/lon and the optional Met Office API key live centrally in the settings app (hotel_location/met_office integrations), not hvac-local, for reuse by other apps later. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
48ffebc08d
commit
915fc0039c
7 changed files with 236 additions and 14 deletions
|
|
@ -46,7 +46,7 @@ export function syncZonesFromNewbook(): Promise<{ ok: boolean; created: number;
|
|||
}
|
||||
|
||||
// Status / activity
|
||||
export function fetchStatus(): Promise<{ mqtt_connected: boolean; zones: ZoneStatus[] }> {
|
||||
export function fetchStatus(): Promise<{ mqtt_connected: boolean; weather_peak_c: number | null; weather_tier: string | null; zones: ZoneStatus[] }> {
|
||||
return request('/status')
|
||||
}
|
||||
export function fetchActivity(zoneId?: number, limit = 100): Promise<ActivityEntry[]> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue