
Plan Kimi K2.7-coder----Own plan
To understand this blog post you need to read the post "Keeeping token cost down and evaluation test" and the other posts
Plan: Tesla Cheapest-Hours Charge Planner
Build a minimal Dockerized Node.js app that charges a Tesla during the cheapest Danish electricity hours, keeps the car ready by a configurable morning time, and stays within the Tesla Fleet API $10 individual-developer credit by polling SOC only twice daily (18:00 and 20:00) and issuing only start/stop commands.
Decisions
- Price source: Energi Data Service (energidataservice.dk), region DK1/DK2 configurable.
- Tariffs: editable tiers in the web UI.
- Car state: poll SOC at 18:00 and 20:00; assume car is home at planning time.
- Target SOC: default 80%, user-configurable; battery capacity via dropdown (Model Y Standard 2026 default); charger kW user-configurable.
- Algorithm: compute hours needed from SOC gap, battery kWh, charger kW, and efficiency; find cheapest contiguous window before departure time; issue
charge_startat start andcharge_stopat end. - Stack: Node.js + Express backend, in-process
node-cron, plain HTML/vanilla JS frontend (no build), JSON file storage in mounted./data. - Tesla integration: copy simplified OAuth PKCE flow from the existing Tesla app, AES-encrypt tokens, use a separate Vehicle Command Proxy (VCP) sidecar for command signing.
- Containers: 2 containers — combined backend+frontend, plus VCP sidecar.
- Scheduling: fetch prices once daily; SOC poll at 18:00/20:00; command execution at planned window boundaries.
- UI settings: departure time, target SOC, active days bitmask, region, tariff tiers, charger kW, car model.
- Notifications: optional ntfy.sh.
- Overrides: charge now, stop charging, skip tonight.
- API usage tracking: log and display Fleet API call counts.
- Deployment: Cloudflare Tunnel for public HTTPS OAuth callback;
SERVER_URLconfigurable.
Phases
- Scaffold project —
package.json, Express server, Dockerfiles,docker-compose.yml, VCP sidecar. - Storage & config — JSON file helpers, config schema, API usage log.
- Tesla auth — OAuth PKCE, token refresh, encrypted token storage, public key endpoint.
- Tesla commands — VCP client, start/stop charging, wake-up, SOC read.
- Price fetcher — Energi Data Service client, price cache, tariff editor.
- Optimizer — hours-needed calculation, cheapest contiguous window search.
- Scheduler — node-cron jobs for prices, SOC polls, command execution.
- Web UI — settings page, schedule view, status, manual overrides, API usage view.
- Notifications — ntfy.sh integration.
- Deployment docs — Cloudflare Tunnel setup, Tesla developer app registration, env vars.
Relevant files to create
package.jsonsrc/index.js— Express server, static UI, API routessrc/config.js— JSON config storagesrc/tesla/auth.js— OAuth PKCE, token refreshsrc/tesla/client.js— VCP/Fleet API wrapper, start/stop/SOCsrc/tesla/keys.js— EC key generationsrc/prices/energidata.js— Energi Data Service fetchersrc/prices/tariffs.js— tariff calculationsrc/scheduler/optimizer.js— cheapest window calculationsrc/scheduler/jobs.js— node-cron jobssrc/notifications/ntfy.js— ntfy.sh senderpublic/index.html— settings/status UIpublic/app.js— frontend logicDockerfilevcp/Dockerfiledocker-compose.yml.env.exampleREADME.md
Verification
docker-compose up --buildstarts backend and VCP without errors.- OAuth flow completes and stores encrypted tokens.
- Price fetcher returns hourly DK1/DK2 prices.
- Optimizer selects cheapest contiguous window for a sample SOC/departure.
- Scheduler triggers start/stop commands at correct times in a test environment.
- Web UI shows config, planned schedule, status, and API call count.
- ntfy.sh notifications sent on start/stop/error.
Scope excluded
- Geofencing / home detection (assumed home at 18:00/20:00).
- Per-day departure/SOC schedules (active-days bitmask only).
- Multiple vehicles.
- Cloud hosting instructions beyond Cloudflare Tunnel.
- Advanced telemetry or analytics.
Share this post
Related Posts

Plan MAI----Own plan
To understand this blog post you need to read the post "Keeeping token cost down and evaluation test" and the other posts
July 4, 2026

Plan Big Pickle----Own plan
To understand this blog post you need to read the post "Keeeping token cost down and evaluation test" and the other posts
July 4, 2026

Keeping token cost down and evaluation test
I asked tree different LLMs and AI "coder appa" to writhe a plan for a Tesla Charging app, with the goal of not using the token limit agains the Tesla APi (10$) free pr month. and to make the none High-end LLMs to make the plan. and i used /grill-me for all of them
July 4, 2026
Comments
Be the first to leave a comment.