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
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package weather
|
|
|
|
import "time"
|
|
|
|
// HourlyForecast represents a single hour's weather data.
|
|
type HourlyForecast struct {
|
|
Timestamp time.Time
|
|
TemperatureC float64
|
|
ApparentTempC float64
|
|
HumidityPct float64
|
|
DewPointC float64
|
|
CloudCoverPct float64
|
|
WindSpeedMs float64
|
|
WindDirectionDeg float64
|
|
PrecipitationMm float64
|
|
SunshineMin float64
|
|
ShortwaveRadW float64
|
|
PressureHpa float64
|
|
IsDay bool
|
|
Condition string
|
|
}
|
|
|
|
// DailyForecast represents a single day's summary data.
|
|
type DailyForecast struct {
|
|
Date time.Time
|
|
TempMaxC float64
|
|
TempMinC float64
|
|
ApparentTempMaxC float64
|
|
Sunrise time.Time
|
|
Sunset time.Time
|
|
}
|
|
|
|
// ForecastResponse holds the full forecast response from a provider.
|
|
type ForecastResponse struct {
|
|
Hourly []HourlyForecast
|
|
Daily []DailyForecast
|
|
Source string
|
|
}
|
|
|
|
// Warning represents a weather warning.
|
|
type Warning struct {
|
|
ID string
|
|
EventType string
|
|
Severity string
|
|
Headline string
|
|
Description string
|
|
Instruction string
|
|
Onset time.Time
|
|
Expires time.Time
|
|
}
|