Skip to content

fix(tesla_vehicle): recover missing SoC with bounded telemetry wakes - #167

Merged
frahlg merged 2 commits into
mainfrom
codex/tesla-soc-recovery-20261006
Oct 6, 2026
Merged

frahlg merged 2 commits into
mainfrom
codex/tesla-soc-recovery-20261006

Conversation

@frahlg

@frahlg frahlg commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Missing SoC, partial HTTP 200 and old cached payloads now trigger a bounded telemetry wake/read instead of waiting for the 30-minute startup cadence. The driver uses the dedicated wake_up endpoint, which vehicle_data cache hits cannot bypass, and keeps the BMS timestamp instead of renewing SoC at HTTP receipt.

Core saves the wake budget by hardware identity before a request: at least 90 seconds between attempts, at most three per 30-minute window. Restart and rename do not restore it. The driver keeps the three-minute 408/503 backoff and rejects unsuccessful wake results even with HTTP 200. Telemetry recovery never sends charge_start; its existing charging path remains separate.

Requires the paired Core change for unix_ms, reserve_vehicle_wake, source timestamps and a refresh recipient independent of fresh SoC. Hosts without the new functions do not run recovery or treat an unknown source age as fresh. This remains beta; no physical Tesla BLE recovery test has run.

Refs srcfl/ftw#1253. Paired with srcfl/ftw#1521. Core #1449 already owns the bundle pin; reconcile that pin after the driver merge before publishing a beta with this fix.

Validation: make test-driver ID=tesla_vehicle; make check (4,810 passed, 923 skipped); the recovery harness also passes under a double-precision Lua interpreter. It covers cold start, missing/old/invalid source data, empty/partial/invalid HTTP 200, HTTP failures, 408/503, saved restart budget, wake-only goal refresh and rejected wake responses. A local probe also loaded this exact source in Core's gopher-lua runtime against a fake proxy and state DB: missing/old SoC recovered to 100%, repeated cache did not renew source time, and rename did not add a wake.

frahlg added 2 commits October 6, 2026 11:01
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@frahlg
frahlg merged commit c9de251 into main Oct 6, 2026
5 checks passed
@frahlg
frahlg deleted the codex/tesla-soc-recovery-20261006 branch October 6, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant