Repository navigation
Conversation
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
miravoss26
left a comment
There was a problem hiding this comment.
vag_vehicle 0.3.1: picks the newest SoC point by timestamp instead of dataset order, both when indexing duplicate keys/names and when choosing between candidate fields. Adds a bounded, VIN-masked diagnostic log per dataset.
- Logic reads right: valid timestamp beats missing/invalid, equal or unknown times fall back to row order, fractional seconds compared.
parse_datasetpassesindex_pointsstraight through, so the second return value reachesdriver_poll. - Out-of-range SoC values (<0, >100, non-numeric) are now dropped at index time but still kept as candidates for the log. Intended per the tests, but it does change behavior for any dataset that used to surface a bad value.
- Low: up to 33 info log lines per dataset poll. Fine for now, worth watching if the poll interval is short.
- Security screen: no secrets, no new hosts or dependencies, VIN masked in the log (tested). Synthetic test data only.
- CI green (drivers, dco, secret scan).
Safe to merge from my read.
miravoss26
left a comment
There was a problem hiding this comment.
Picks the SoC row by parsed measurement time (offset- and fraction-aware) instead of last-row-wins, falls back to row order on ties or missing times, and logs a bounded, VIN-masked selection summary per new dataset.
Read the whole diff, nothing blocking.
- Security: nothing. The diagnostics log only SoC key/name/value/timestamp and a masked filename, capped at 32 rows.
server_now_sis defined at file scope, so the fetched-at field is fine. - Needs a decision (behaviour change):
index_pointsnow drops SoC rows that are non-numeric or outside 0–100 before the timestamp comparison. So a newerN/Aor101loses to an older valid 73 %, and the driver reports the older value as current. The test asserts this on purpose, but it isn't in the PR description. If an invalid newest row should mean "unknown", this will mask a stale-upstream case, which is the very thing the diagnostics are meant to expose. Fine if intended, just worth saying out loud. - Low:
iso_epochdoesn't range-check month/day/hour, so a malformed-but-matching timestamp like2026-13-45T…gets an epoch and can outrank a valid one. Unlikely from the portal, cheap to guard. - Nit: the test names a local
select, shadowing the builtin. Harmless.
Safe to merge from my read, assuming the invalid-SoC fallback is intended.
|
This PR is the fix for #188; main still picks the SoC by sequence number, so the bug is live there. One point from the review: SoC rows that are not numbers or fall outside 0–100 are now dropped before the timestamp compare. Please say why that is better than keeping them as candidates. Do you have a real portal dataset, with the VIN removed, with two SoC rows at different times? The issue only has synthetic input. |
|
Follow-up to @frahlg’s review. The SoC value is validated before the timestamp comparison because indexing keeps only one row per key or name. If a newer row contains a non-numeric value such as I checked the available logs for 146 real portal datasets. Every file contained at most one SoC candidate. There are real measurements with different timestamps across separate files, but I have yet to find a real file with two timestamped SoC candidates. Selection between competing rows in the same file remains covered by the synthetic regression tests. The existing diagnostics can capture both rows if the portal delivers such a file. Separately, VAG has acknowledged problems with SoC updates in its EU Data Act portal since late October, according to the operator. SoC updates are still arriving sporadically. For example, two portal files fetched on 21 November at 14:27 and 14:47 CET both carried an 80% measurement from 20 November at 08:09:56 UTC. The patch chooses the latest valid measurement available in a dataset. The freshness of that measurement still depends on the portal. |
Fredrik, 21 Nov 2026: a driver that can command its device ships with control on; one that cannot says so plainly. - Remove local easee and zaptec. Easee and Zaptec document no local API; the two drivers read an invented Modbus map and a made-up HTTP path. Use easee_cloud, zaptec_cloud or the charger's OCPP to FTW. - tesla_wall_connector 0.2.0: Tesla offers no way for another system to set its current. driver_command now refuses instead of answering true while writing nothing. - teslamate_vehicle 0.2.1, home_assistant_vehicle 0.1.1, tesla_cloud 0.2.1: the description and notes say why FTW cannot control the car through them and where control goes instead. vag_vehicle waits for #213, which has right of way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
* fix: read-only EV drivers say why, drop two that read nothing Fredrik, 21 Nov 2026: a driver that can command its device ships with control on; one that cannot says so plainly. - Remove local easee and zaptec. Easee and Zaptec document no local API; the two drivers read an invented Modbus map and a made-up HTTP path. Use easee_cloud, zaptec_cloud or the charger's OCPP to FTW. - tesla_wall_connector 0.2.0: Tesla offers no way for another system to set its current. driver_command now refuses instead of answering true while writing nothing. - teslamate_vehicle 0.2.1, home_assistant_vehicle 0.1.1, tesla_cloud 0.2.1: the description and notes say why FTW cannot control the car through them and where control goes instead. vag_vehicle waits for #213, which has right of way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> * docs: drop two unsourced claims from driver comments Review: 'most business cars' skipping Tesla's signed commands has no source, and Home Assistant answering 500 on a failed action was not confirmed. Both were comments only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> --------- Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, that answers both points. Rejecting a bad value before indexing keeps the older good row, and the tests cover |
miravoss26
left a comment
There was a problem hiding this comment.
What it does: vag_vehicle now picks the SoC point by measured timestamp (offset and fractional-second aware) in both index_points and lookup, and logs a bounded, VIN-masked diagnostic per downloaded dataset.
- note:
index_pointsnow also drops SoC rows outside 0-100 or non-numeric before indexing (vag_vehicle.luaindex_points). That is a behaviour change beyond the title. The tests cover it ("N/A", -1, 101, and 0 kept), so I think it is intended, but it deserves a line in the description. - nit: the comment above
point_is_newersays the same row keeps the earlier candidate priority, but a full tie resolves to the higherseq(candidate.seq > current.seq). Behaviour matches the tests, the comment just reads the other way. - security screen: no secrets, no new dependencies, no new hosts. Diagnostics log only SoC key/name/value/timestamp and a masked VIN. Filename goes through a character whitelist and is truncated.
Safe to merge from my read. CI is green on cb6befa.
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
Portal datasets may contain multiple points for the same field or different SoC candidates. index_points previously kept the last row per key/name and lookup chose the greatest row number, allowing an older measurement to hide a newer one.
Both stages now compare parsed measurement timestamps, including timezone offsets and fractional seconds. Valid timestamps outrank missing or invalid ones; equal or unavailable timestamps retain row-order fallback. Before indexing, non-numeric SoC values and values outside 0–100% are discarded so a newer invalid row cannot hide an older valid measurement. Discarded candidates remain visible in the selection diagnostics. Bumps vag_vehicle to 0.3.1 and refreshes generated metadata.
Adds diagnostics once per newly downloaded dataset: VIN-masked filename, portal fetch time, candidate count, selected row and selection reason. Logs up to 32 SoC candidate rows (including those discarded by indexing), with key/name, value, timestamp and selection flag; excess rows are counted. No raw datasets or credentials are logged. This distinguishes stale upstream measurements from incorrect local selection.
Validation:
Synthetic regression harness covers duplicate keys/shared names, candidate GUIDs, both row orders, missing/invalid/equal timestamps, offsets, fractional seconds, empty values and nil inputs. Original 0.3.0 fails the newest-first case.
Diagnostic tests cover discarded candidates, selection reasons, no candidates, truncation and VIN masking.
make test-driver ID=vag_vehicle: 40 passed, 16 skipped.
make check: 5091 passed, 951 skipped on the branch updated against main; manifests, generated metadata, source history, host API and sandbox checks passed.
Updated code installed locally on FTW Core v0.159.0-beta.1+local.3 with an Audi e-tron: restart/authentication/download succeeded; actual dataset diagnostics showed one SoC candidate with an old measurement timestamp and correctly masked VIN. Firmware was not recorded. Competing SoC candidates in a single dataset are covered by the regression harness.
Live follow-up on 12 November 2026: two separate portal datasets were fetched at 17:04 and 17:14 CET. Each contained one candidate at 80%, with the same measurement timestamp of 11 November 2026 at 05:31:06 UTC. The driver selected that observation by timestamp and logged the fetch and measurement times separately. This confirms that a newly delivered file can contain an old measurement. These runs do not exercise competing candidates in the same real dataset.
No credentials, VINs or raw site datasets are included. This does not refresh stale upstream data. After merge, FTW must advance its bundled-driver source pin and regenerate its recovery snapshot to reach bundled installations.
Fixes #188.