Skip to content

feat(ev): set the charging schedule from the phone, weekdays and all - #20

Merged
frahlg merged 2 commits into
mainfrom
the-week-taught-to-the-schedule
Aug 9, 2026
Merged

feat(ev): set the charging schedule from the phone, weekdays and all#20
frahlg merged 2 commits into
mainfrom
the-week-taught-to-the-schedule

Conversation

@frahlg

@frahlg frahlg commented Aug 9, 2026

Copy link
Copy Markdown
Member

The app half of srcfl/ftw#869 (merged; ships in v1.16.1-beta.11). The box gave the charging schedule its own Configure-priced route; this teaches the EV panel to use it.

The pen, for owners only. The schedule row gets a Change button (and "Set a charging schedule" where none exists): ready-by time on the kitchen clock, seven weekday chips — a zero mask means every day, so an untouched week honestly reads all-on — and the target charge. One draft, one PUT, one passkey ceremony, never a prompt per field. Remove sits beside Cancel when there is something to remove.

Nothing optimistic. The box answers, the panel rereads from /api/loadpoints, and until then the old schedule stands on screen as the truth it is. A failed ceremony says what happened ("Nothing was changed") and cancels back to exactly the schedule that was. Viewers see the schedule and never the pen — presentation on top of the box's refusal, not instead of it.

The simulator plays the new box. PUT/DELETE /api/loadpoints/{id}/schedule at Configure with the box's own validation (0..1439 minutes, 7-bit mask), a stored mutable schedule, and honest absence after DELETE — so the tests meet state, not an echo. Against a real box without the route, the pen meets the existing "Your box doesn't have that yet" sentence.

daysWord renders the mask the way a person says it: weekdays, weekends, every day, or the short names in week order. Conversions between the kitchen clock and the wire's UTC minutes live in one module with a round-trip test that passes in any zone — CI deliberately pins none.

Verified: full npm run verify green (763 tests — 18 new), and the editor exercised in a browser against the simulator.

🤖 Generated with Claude Code

The other half of srcfl/ftw#869. The box gave the schedule its own
Configure-priced door; this teaches the panel to use it.

- The schedule row grows a pen for owners: ready-by time on the kitchen
  clock, seven weekday chips (a zero mask is every day, so an untouched
  week reads all-on), and the target charge. One draft, one PUT, one
  passkey ceremony — never a prompt per field.
- Nothing applies optimistically: the box answers, the panel rereads,
  and until then the old schedule stands as the truth it is. A failed
  ceremony says what happened and changes nothing.
- Viewers see the schedule and never the pen; the box would refuse them
  anyway, and the hidden button is presentation on top of that refusal.
- The simulator serves the new route at the box's own price, stores what
  it is handed, and serves absence after a DELETE — so the tests meet
  a mutable schedule, not an echo.
- daysWord says the mask the way a person does: weekdays, weekends,
  every day, or the short names in week order.

Against a box without the route, the pen meets "Your box doesn't have
that yet" — the sentence that already exists for exactly this.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
ftw-webapp 67da22a Aug 09 2026, 03:59 PM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a79adb45d

ℹ️ 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".

Comment thread src/views/EvPanel.svelte
Comment on lines +85 to +86
function toggleDay(bit: number): void {
if (draft) draft.days ^= 1 << bit

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Expand the all-days sentinel before toggling a day

When draft.days is zero, all seven chips are rendered as pressed, but clicking a pressed chip XORs against zero: clicking Sat produces 32, which means Saturday-only rather than every day except Saturday. Consequently, the natural sequence of clicking Sat and Sun to select weekdays instead saves weekends, potentially charging on the opposite days intended; normalize zero to 0x7f before clearing the selected bit.

Useful? React with 👍 / 👎.

The draft now holds all seven bits where the wire holds zero, so the
chips read as they act; all-seven canonicalises back to the wire's
zero on save, and a week with every day off cannot be saved at all —
the wire would have read it as its opposite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@frahlg
frahlg merged commit 293efdf into main Aug 9, 2026
3 checks passed
@frahlg
frahlg deleted the the-week-taught-to-the-schedule branch August 9, 2026 16:00
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