From 19ed27fa54f52ae6b4152fd6c23c4d88d208ca87 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 28 Jul 2026 20:02:17 +0000 Subject: [PATCH] vw/eudataact: fall back to battery care mode field for target SoC (#32242) --- vehicle/vw/eudataact/eudataact_test.go | 11 +++++++++++ vehicle/vw/eudataact/provider.go | 2 +- vehicle/vw/eudataact/types.go | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/vehicle/vw/eudataact/eudataact_test.go b/vehicle/vw/eudataact/eudataact_test.go index 5d7b97ad2..1c0cd8482 100644 --- a/vehicle/vw/eudataact/eudataact_test.go +++ b/vehicle/vw/eudataact/eudataact_test.go @@ -237,6 +237,17 @@ func TestSocBatteryStateReportOnlyFallbackField(t *testing.T) { assert.Equal(t, 40.0, soc) } +// TestGetLimitSocBcamThreshold reproduces issue #32241: the Audi Q4 e-tron +// reports its battery care mode SoC limit only under the battery care mode +// field, not under the generic target soc field. +func TestGetLimitSocBcamThreshold(t *testing.T) { + data := []point{{Name: FieldChargeBcamThreshold, Value: "80"}} + + limit, err := testProvider(data).GetLimitSoc() + require.NoError(t, err) + assert.Equal(t, int64(80), limit) +} + // TestPoints guards that a data point with a generic field name ("value") is // stored once yet found by both its unique key and its name. func TestPoints(t *testing.T) { diff --git a/vehicle/vw/eudataact/provider.go b/vehicle/vw/eudataact/provider.go index 3fc37735a..fcc65c310 100644 --- a/vehicle/vw/eudataact/provider.go +++ b/vehicle/vw/eudataact/provider.go @@ -188,7 +188,7 @@ func (v *Provider) GetLimitSoc() (int64, error) { return 0, err } - if p := lookup(data, FieldTargetSoc); p != nil { + if p := lookup(data, FieldTargetSoc, FieldChargeBcamThreshold); p != nil { f, err := strconv.ParseFloat(p.Value, 64) return int64(f), err } diff --git a/vehicle/vw/eudataact/types.go b/vehicle/vw/eudataact/types.go index 35752c29c..8b5ffa5ab 100644 --- a/vehicle/vw/eudataact/types.go +++ b/vehicle/vw/eudataact/types.go @@ -130,7 +130,8 @@ const ( FieldHvBatteryLevelValue = "battery_level_HV.value" // target soc - FieldTargetSoc = "settings.target_soc" + FieldTargetSoc = "settings.target_soc" + FieldChargeBcamThreshold = "battery_care_mode.charge_bcam_threshold" // Audi Q4 e-tron battery care mode target soc // range FieldRangeCombined = "cruising_range_combined"