cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.901: full source

This commit is contained in:
Setti Solutions S.R.L committed 2026-11-05 13:14:49 +02:00
1 parent d48b9aff87
commit e2c7085d2c
76 files changed
+5380 -330

No files matched your search

+33
View File
@@ -92,3 +92,36 @@ func TestPageTextsBothLanguages(t *testing.T) {
}
}
}
// docs/parameters.md U3: the page says what is declared toward the control
// box, or why nothing is, and takes the owner's rating.
func TestPageLPCAndRating(t *testing.T) {
h := newHarness(t, Options{})
p := &Page{core: h.core, peers: []string{"172.30.32.2"}, ha: true}
do := func(method string, form url.Values) string {
r := httptest.NewRequest(method, "/", strings.NewReader(form.Encode()))
r.RemoteAddr = "172.30.32.2:1"
r.Header.Set("Content-Type", "application/x-www-form-urlencoded")
r.Header.Set("Accept-Language", "en")
w := httptest.NewRecorder()
p.ServeHTTP(w, r)
return w.Body.String()
}
if b := do("GET", nil); !strings.Contains(b, "LPC not offered: nominal power unknown: no controllable device (heat pump, wallbox) paired.") {
t.Fatal("no device: refused, said")
}
hp := h.pair("hp01", "Vaillant", "aroTHERM plus", "HeatPumpAppliance", "Heat pump")
b := do("GET", nil)
if !strings.Contains(b, "nominal power unknown: enter the controllable devices' ratings (Heat pump)") ||
!strings.Contains(b, `name="action" value="rating"`) {
t.Fatal("a heat pump without its power: refused, the rating form")
}
do("POST", url.Values{"action": {"rating"}, "dev": {hp.ID}, "kw": {"7,5"}})
if hp.RatedW != 7500 {
t.Fatalf("rated: %v", hp.RatedW)
}
if b := do("GET", nil); !strings.Contains(b, "Toward the control box: nominal power 7500 W declared (LPC offered).") ||
!strings.Contains(b, `value="7.5"`) {
t.Fatal("declared")
}
}