From 2cfe81da0da3476e98e32f9e803410a0476dc8a2 Mon Sep 17 00:00:00 2001 From: Fredrik Ahlgren Date: Wed, 14 Oct 2026 08:17:45 +0200 Subject: [PATCH] fix(drivers): bundle sungrow 1.6.0, read once a second Move the pin to srcfl/device-drivers afc9739 (#179). Two Sungrow tests polled back to back and expected the running state on every poll; 1.6.0 reads it on a full read every five seconds, so they move the driver's clock five seconds before each poll. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Fredrik Ahlgren --- .changeset/bundle-sungrow-1hz.md | 5 +++++ drivers/BUNDLED_SOURCE.json | 2 +- go/internal/drivers/sungrow_driver_test.go | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changeset/bundle-sungrow-1hz.md diff --git a/.changeset/bundle-sungrow-1hz.md b/.changeset/bundle-sungrow-1hz.md new file mode 100644 index 000000000..ce30d2427 --- /dev/null +++ b/.changeset/bundle-sungrow-1hz.md @@ -0,0 +1,5 @@ +--- +"ftw": patch +--- + +Bundle sungrow 1.6.0, which reads grid, PV and battery power, SoC and per-phase values once a second, so live figures on the phone move every second instead of every five. Counters, temperature, frequency and fault bits keep the five-second rate. diff --git a/drivers/BUNDLED_SOURCE.json b/drivers/BUNDLED_SOURCE.json index 32ba7bbc1..811600f4c 100644 --- a/drivers/BUNDLED_SOURCE.json +++ b/drivers/BUNDLED_SOURCE.json @@ -16,7 +16,7 @@ "from the signed channel. Run scripts/sync-bundled-drivers.sh to update." ], "repository": "srcfl/device-drivers", - "commit": "c9de25106b07071fde55c9f8f5e95b69c58e6fc9", + "commit": "afc9739dd19920246cadaa5135baa85485840528", "source_dir": "drivers/lua", "drivers": [ "ambibox_v2x", "ctek", "ctek_hybrid", "ctek_v2", "deye", "easee_cloud", diff --git a/go/internal/drivers/sungrow_driver_test.go b/go/internal/drivers/sungrow_driver_test.go index fa4be7106..86b5ac5a0 100644 --- a/go/internal/drivers/sungrow_driver_test.go +++ b/go/internal/drivers/sungrow_driver_test.go @@ -5,6 +5,7 @@ import ( "encoding/json" "strings" "testing" + "time" "github.com/srcfl/ftw/go/internal/telemetry" ) @@ -267,6 +268,13 @@ func TestSungrowFeedInCurtailPreservesConfiguredInstallerLimit(t *testing.T) { } } +// sungrow.lua reads power every second and its running state, counters and +// fault bits on a full read every five seconds, timed by host.millis. Move +// the driver's clock past one so the next poll is a full read. +func untilNextFullRead(env *HostEnv) { + env.Start = env.Start.Add(-5 * time.Second) +} + func TestSungrowPollSurfacesAndClearsThermalDeviceFault(t *testing.T) { tel := telemetry.NewStore() modbus := newRecordingModbus() @@ -298,6 +306,7 @@ func TestSungrowPollSurfacesAndClearsThermalDeviceFault(t *testing.T) { modbus.regs[12999] = 0x0040 // Running on-grid modbus.regs[13055] = 0 + untilNextFullRead(env) if _, err := d.Poll(context.Background()); err != nil { t.Fatalf("recovery poll: %v", err) } @@ -332,6 +341,7 @@ func TestSungrowProbesTheHybridBlockWhenTheDeviceTypeNeverAnswers(t *testing.T) // settles within a couple of polls rather than retrying for the session. var faulted bool for poll := 0; poll < 4; poll++ { + untilNextFullRead(env) if _, err := d.Poll(context.Background()); err != nil { t.Fatalf("poll %d: %v", poll, err) }