Fix Viessmann API hostname and harden test propagation waits
- Update apiBase: api.viessmann.com → api.viessmann-climatesolutions.com (Viessmann renamed their IoT API host; old domain is NXDOMAIN) - Extend --test-viessmann context to 120s - Add 30s propagation wait before read-back in both Stage 3 and Restore: cloud accepts writes immediately but gateway polls on its own schedule, so GET returns the last confirmed device value with ~30s lag Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
main.go
13
main.go
@@ -361,7 +361,7 @@ func computeWWBoost(fc *forecast.Result, cfg *config.Config) float64 {
|
||||
//
|
||||
// Returns 0 on success, 1 on any failure.
|
||||
func runViessmannTest(vc *viessmann.Client) int {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
|
||||
defer cancel()
|
||||
|
||||
pass := func(format string, args ...any) { fmt.Printf(" PASS "+format+"\n", args...) }
|
||||
@@ -396,15 +396,18 @@ func runViessmannTest(vc *viessmann.Client) int {
|
||||
}
|
||||
pass("round-trip confirmed (%.1f°C)", readback)
|
||||
|
||||
// Stage 3: +1°C delta — heat pump won't notice (5°C hysteresis), but API change is visible
|
||||
// Stage 3: +1°C delta — heat pump won't notice (5°C hysteresis), but API change is visible.
|
||||
// The Viessmann cloud queues the write to the gateway; the GET endpoint returns the last
|
||||
// *confirmed* device value, so we wait up to 30s for the change to propagate.
|
||||
delta := original + 1
|
||||
step("Stage 3 — +1°C delta test (%.1f°C → %.1f°C)", original, delta)
|
||||
if err := vc.SetDHWTemperature(ctx, delta); err != nil {
|
||||
fail("SetDHWTemperature(%.1f): %v", delta, err)
|
||||
// Try to restore before returning
|
||||
_ = vc.SetDHWTemperature(ctx, original)
|
||||
return 1
|
||||
}
|
||||
fmt.Println(" ...waiting 30s for cloud→gateway propagation...")
|
||||
time.Sleep(30 * time.Second)
|
||||
readback, err = vc.GetDHWTemperature(ctx)
|
||||
if err != nil {
|
||||
fail("read-back after +1°C: %v", err)
|
||||
@@ -412,7 +415,7 @@ func runViessmannTest(vc *viessmann.Client) int {
|
||||
return 1
|
||||
}
|
||||
if readback != delta {
|
||||
fail("+1°C mismatch: wrote %.1f, read back %.1f", delta, readback)
|
||||
fail("+1°C mismatch: wrote %.1f, read back %.1f after 30s — gateway may be offline or propagation takes longer", delta, readback)
|
||||
_ = vc.SetDHWTemperature(ctx, original)
|
||||
return 1
|
||||
}
|
||||
@@ -424,6 +427,8 @@ func runViessmannTest(vc *viessmann.Client) int {
|
||||
fail("restore SetDHWTemperature(%.1f): %v", original, err)
|
||||
return 1
|
||||
}
|
||||
fmt.Println(" ...waiting 30s for cloud→gateway propagation...")
|
||||
time.Sleep(30 * time.Second)
|
||||
readback, err = vc.GetDHWTemperature(ctx)
|
||||
if err != nil {
|
||||
fail("read-back after restore: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user