generated from rmcguire/go-server-with-otel
add ui, new config opts
This commit is contained in:
@@ -45,6 +45,26 @@ Exporter for Rheem EcoNet / Rheemcloud water heaters, built on the
|
||||
`list_water_heaters` tool delegating to the gRPC server. Kept in place as a
|
||||
fallback. **Switch between the two** with the aliased `econetmcp` import in
|
||||
`pkg/econet/econet.go` (one line — both packages export identical symbols).
|
||||
- `pkg/econet/econetui/` — admin UI served at **`/`** (the root; the HTTP
|
||||
server is not "under `/api`" — only the grpc-gateway is, via
|
||||
`grpcGatewayPath`). Gated by `enableWebUI` (default true). Server-rendered
|
||||
`html/template` + embedded assets (`embed.FS`: Pico.css classless, HTMX,
|
||||
per-`generic_type` SVG icons) with a dark-mode toggle (persisted in
|
||||
`localStorage`). Reads devices and writes mode through the in-process gRPC
|
||||
server, same as the MCP packages. Routes: `GET /` (page), `GET /ui/devices`
|
||||
(HTMX poll partial, every 30s), `POST /ui/devices/{serial}/mode` (returns a
|
||||
re-rendered card), `GET /ui/devices/{serial}/debug` (raw device JSON for the
|
||||
🐛 modal), `GET /static/`. A **fill-level meter** visualizes hot-water
|
||||
availability. `iconFor` matches `@TYPE` loosely (substring, case/spacing
|
||||
insensitive) since real values vary (e.g. `heatpumpWaterHeaterGen5`).
|
||||
Template funcs (`fillClass`/`fillWidth`) take **int32** to match proto fields
|
||||
— `html/template` is strict about arg types.
|
||||
**Pending state** for a mode change is best-effort: `pending.go` holds a
|
||||
TTL-bounded (`pendingTTL`, 90s) desired-mode hint, shown as an "Updating…"
|
||||
badge and cleared once the reported mode converges; a full page load ignores
|
||||
it (fresh reported state), the poll honors it. **Auth is left to the edge**
|
||||
(oauth2-proxy) — the UI/write live at `/` and `/ui/`; keep `/health` and
|
||||
`/metrics` on skip-auth so probes/Prometheus keep working.
|
||||
- `pkg/econet/econetmetrics/` — OTEL observable gauges (read the client
|
||||
snapshot at scrape time; no poller of its own).
|
||||
|
||||
@@ -60,6 +80,14 @@ that's all it takes — no extra wiring.
|
||||
|
||||
- `costPerKWH` is **US dollars per kWh** (0.18 = 18¢), feeding
|
||||
`econet_energy_cost_dollars`.
|
||||
- **The `default:` tag is NOT applied at runtime for custom `ServiceConfig`
|
||||
fields** — `LoadEnv` uses plain `env.Parse` (no `DefaultValueTagName`), so
|
||||
`default:` only feeds the JSON schema. A bool that must default to true
|
||||
therefore can't be a plain `bool` (zero value = false); `enableWebUI` is a
|
||||
`*bool` where nil ⇒ enabled (read via `WebUIEnabled()`). `disableWaterUsage`
|
||||
is a plain `bool` because its desired default (poll water usage) is the zero
|
||||
value — set it true to skip the wasted water-usage REST call on units that
|
||||
don't report it.
|
||||
- `econetTLSInsecure` (env `ECONET_TLS_INSECURE`) skips TLS certificate
|
||||
verification when connecting to the EcoNet cloud API. It exists because the
|
||||
upstream host (cloudblade) serves a
|
||||
|
||||
Reference in New Issue
Block a user