Add server-side rendered setup UI accessible via `heatwave web`. The dashboard is now re-rendered per request and includes a nav bar linking to the new /setup page. Setup provides full CRUD for profiles, rooms, devices, occupants, AC units (with room assignment), scenario toggles, and forecast fetching — all via POST/redirect/GET forms. - Add ShowNav field to DashboardData for conditional nav bar - Extract fetchForecastForProfile() for reuse by web handler - Create setup.html.tmpl with Tailwind-styled entity sections - Create web_handlers.go with 15 route handlers and flash cookies - Switch web.go from pre-rendered to per-request dashboard rendering - Graceful dashboard fallback when no forecast data exists
69 lines
1.7 KiB
Go
69 lines
1.7 KiB
Go
package action
|
|
|
|
import (
|
|
"github.com/cnachtigall/heatwave-autopilot/internal/heat"
|
|
"github.com/cnachtigall/heatwave-autopilot/internal/risk"
|
|
)
|
|
|
|
type Category string
|
|
|
|
const (
|
|
Shading Category = "shading"
|
|
Ventilation Category = "ventilation"
|
|
InternalGains Category = "internal_gains"
|
|
ACStrategy Category = "ac_strategy"
|
|
Hydration Category = "hydration"
|
|
Care Category = "care"
|
|
)
|
|
|
|
type Effort string
|
|
|
|
const (
|
|
EffortNone Effort = "none"
|
|
EffortLow Effort = "low"
|
|
EffortMedium Effort = "medium"
|
|
EffortHigh Effort = "high"
|
|
)
|
|
|
|
type Impact string
|
|
|
|
const (
|
|
ImpactLow Impact = "low"
|
|
ImpactMedium Impact = "medium"
|
|
ImpactHigh Impact = "high"
|
|
)
|
|
|
|
type TimeCondition struct {
|
|
HourFrom int `yaml:"hour_from"`
|
|
HourTo int `yaml:"hour_to"`
|
|
MinTempC float64 `yaml:"min_temp_c"`
|
|
MaxTempC float64 `yaml:"max_temp_c"`
|
|
MinRisk string `yaml:"min_risk"`
|
|
BudgetStatus string `yaml:"budget_status"`
|
|
NightOnly bool `yaml:"night_only"`
|
|
HighHumidity bool `yaml:"high_humidity"`
|
|
}
|
|
|
|
type Action struct {
|
|
ID string `yaml:"id"`
|
|
Name string `yaml:"name"`
|
|
Description string `yaml:"description"`
|
|
Category Category `yaml:"category"`
|
|
Effort Effort `yaml:"effort"`
|
|
Impact Impact `yaml:"impact"`
|
|
When TimeCondition `yaml:"when"`
|
|
DependsOn []string `yaml:"depends_on"`
|
|
Toggles []string `yaml:"toggles"`
|
|
}
|
|
|
|
// HourContext holds the context for a specific hour used for action matching.
|
|
type HourContext struct {
|
|
Hour int
|
|
TempC float64
|
|
HumidityPct float64
|
|
IsDay bool
|
|
RiskLevel risk.RiskLevel
|
|
BudgetStatus heat.BudgetStatus
|
|
ActiveToggles map[string]bool
|
|
}
|