Repository navigation
Show saved sensor SoC history for each car - #1724
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cec3408c63
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const sources = await readCarLevelHistory(car, range, { fetcher, signal, now: until }); | ||
| if (closed || current !== sequence) return; | ||
| content.replaceChildren(); | ||
| if (!sources.length) node(doc, 'p', content, 'No sensor source is available for this car on this device.', 'soc-note'); |
There was a problem hiding this comment.
Prompt for authentication before declaring no sensor source
When LAN authentication is enabled and the device has not signed in, GET /api/cars deliberately returns HTTP 200 with redacted: true and omits sources; because the LAN auth wrapper prompts only on 401 responses, opening Battery history reaches this branch and falsely reports that no sensor source exists, with no way to authenticate from the flow. The dialog should recognize the redacted car or obtain the protected source list after prompting and refetching.
AGENTS.md reference: AGENTS.md:L22-L23
Useful? React with 👍 / 👎.
| } catch (err) { | ||
| if (signal?.aborted || err?.name === 'AbortError') throw err; | ||
| return { source, points: [], failed: true }; |
There was a problem hiding this comment.
Keep completed source histories when another request times out
For a car with multiple sensor sources, if one request exceeds the dialog's 30-second deadline, the shared controller aborts it and this branch rethrows; consequently Promise.all rejects and the outer dialog replaces every section with one global failure, discarding histories that other sources already returned successfully. Treat a deadline abort as a failed result for that source while retaining rethrows for dialog-close/range-change cancellation, so failures remain distinct and successful evidence remains visible.
AGENTS.md reference: AGENTS.md:L22-L23
Useful? React with 👍 / 👎.
Cars have no way to open the sensor SoC already saved in
history.db. Add Battery history to each car, including unplugged cars, with 24-hour, 7-day and 30-day views through the existingvehicle_socseries API.Show reported levels with their source times, saved averages and ranges. Keep empty history separate from failed reads. Cancel reads when the dialog closes or its range changes. When an older aggregate lacks a last value, label its average as an average. Charging estimates and manual levels never enter this chart.
Depends on #1694. This branch starts at its exact
db790a0a70382d288e9c9f4806b3d40439b5db24head to preserve its car routes and UI. Merge #1694 first; its three commits appear here until then. This PR adds SoC history and clears car-choice feedback when a later plug-in replaces the session. A late reply cannot attach the old refusal to the new session. Charging, storage and deployment policy stay unchanged.Validation:
make verifypasses; all 836 web tests pass on the current branch.The SoC UI is not installed on the box. The owner inspected and approved the rendered SoC view in this chat. The current code also fixes the existing #1694 review about old tap responses; two regressions fail before and pass after, and a browser test verifies that a new plug-in clears the pending/refused note. No beta is published by this PR.