Skip to content

Releases: Haraheriz/tesla-solar-charge

v0.2.1 - Doc fixes, icon generator sync, shared secrets-read hook

27 Jun 07:36
dea6e83

Choose a tag to compare

Patch-level changes, none touching production behavior:

  • Committed tools/gen_icon.py and synced icons/*.png — the icons had been redesigned (gradient background, glow, drop-shadow bolt) and deployed straight to the Pi in a prior session, but the generator script was never saved and the icons in git still held the old flat design.
  • Documented the Tailscale Serve setup and the decision not to enable Funnel in the architecture doc, plus show_control_url.sh usage and a CONTROL_TOKEN rotation runbook in the operations doc — previously only in the gitignored, environment-specific LOCAL_ENV.md.
  • Committed .claude/settings.json, a PreToolUse hook blocking reads of tesla_tokens.json/tesla_config.json/*.pem, so it's shared across machines instead of staying local-only.

本番の動作には影響しないPATCHレベルの変更:

  • tools/gen_icon.pyをコミットしicons/*.pngを同期。以前のセッションでアイコンを再デザイン(グラデーション背景・光彩・ドロップシャドウ付きの雷)してラズパイへ直接反映していたが、生成スクリプトを保存しておらず、Git管理下のアイコンは旧デザインのままだった。
  • TailscaleのServe設定とFunnel不採用の判断をアーキテクチャ文書に、show_control_url.shの使い方とCONTROL_TOKEN漏洩時のローテーション手順を運用文書に記載。以前はgitignore対象・環境固有のLOCAL_ENV.mdにしか無かった内容。
  • .claude/settings.jsontesla_tokens.json/tesla_config.json/*.pemへのReadを拒否するPreToolUseフック)をコミットし、ローカル限定ではなく他端末でも共有されるようにした。

v0.2.0 - Manual full-charge override with phone control PWA

27 Jun 07:36
7929b74

Choose a tag to compare

Deployed and merged via PR #2:

  • Manual full-charge override switchable from a phone: control_server.py + override_state.py, sharing override_state.json with the charging script. Toggling it makes tesla_solar_charger.py ignore solar surplus and charge at full power, waking the vehicle if needed.
  • PWA support: manifest, service worker, and icons so the control page can be added to the home screen and launched standalone.
  • Fixed a bug found right after deploying: while override was on, the charger script re-forced MAX_AMPS every cycle even after the driver manually lowered the charge current via the Tesla app. Now MAX_AMPS is only applied when starting/resuming charging.
  • Reworked the control page: safe-area insets (no more text under the iPhone Dynamic Island/notch or Android cutouts), larger text matching iOS/Android body-text guidelines, a status/button split (status always states the current fact, the button always states the resulting action), WAI-ARIA roles/live-region/aria-pressed, and a centered layout (was left-shifted).
  • Added Tailscale: tailscale serve HTTPS-exposes the control server within the tailnet (Funnel intentionally not enabled), since Android requires a secure context for full PWA install.
  • Added show_control_url.sh to print the tokenized control URL and a terminal QR code.

PR #2でマージ・本番反映:

  • スマホから切替えられるマニュアル・オーバーライド(フル充電モード):control_server.py + override_state.pyoverride_state.jsonを充電スクリプトと共有。ONにするとtesla_solar_charger.pyが太陽光の余剰計算を無視してフル充電(必要なら車両を起動)する。
  • PWA対応:マニフェスト・Service Worker・アイコンを追加し、操作画面をホーム画面に追加してアプリのように起動できるようにした。
  • デプロイ直後に見つけたバグを修正:オーバーライドON中、毎サイクルMAX_AMPSを強制再設定していたため、Teslaアプリで手動で電流を下げても元に戻ってしまっていた。充電開始・再開時のみMAX_AMPSを適用するように修正。
  • 操作画面を改善:セーフエリア対応(iPhoneのDynamic Island/ノッチ、Androidのカットアウトに重ならない)、iOS/Android基準のフォントサイズ拡大、状態とボタンの役割分離(状態は常に事実、ボタンは常に結果のアクション)、WAI-ARIA対応、中央揃え(以前は左にずれていた)。
  • Tailscaleを導入:tailscale serveでtailnet内のみHTTPS公開(Funnelは意図的に不採用)。AndroidでPWAを正式インストールするにはHTTPSが必要なための対応。
  • show_control_url.shを追加し、トークン付きURLと端末上のQRコードを表示できるようにした。

v0.1.1 - Tesla OAuth/TLS hardening

27 Jun 07:36
0e6ca18

Choose a tag to compare

Security hardening found during a security review, deployed to the production Pi via PR #1:

  • Split HTTP sessions: proxy_session (pins cert.pem for the local Tesla proxy) vs cloud_session (standard CA verification for external APIs) — TLS verification intent was previously ambiguous.
  • Randomized the OAuth state parameter (secrets.token_urlsafe(32)) and validated it on callback, closing a CSRF/auth-code-substitution gap (it was previously a fixed "12345").
  • Made cert.pem / tesla_config.json / tesla_tokens.json paths absolute (relative to __file__, overridable via env vars), removing working-directory fragility.
  • Wrote tesla_tokens.json with 0o600 permissions instead of relying on the process umask.

セキュリティレビューで見つかった点を修正し、本番のラズパイへ反映(PR #1):

  • HTTPセッションをproxy_session(ローカルTeslaプロキシ用、cert.pemをピン留め検証)とcloud_session(外部API用、標準CA検証)に分離。以前はTLS検証の意図が不明確だった。
  • OAuthのstateパラメータをランダム化(secrets.token_urlsafe(32))し、コールバック時に検証。CSRF/認可コード差し替え対策が機能していなかった(固定値"12345"だった)問題を解消。
  • cert.pem / tesla_config.json / tesla_tokens.jsonのパスを絶対パス化(__file__基準、環境変数で上書き可能)し、実行時のカレントディレクトリ依存を解消。
  • tesla_tokens.jsonの書き込み権限を0o600に明示し、プロセスのumask依存を解消。

v0.1.0 - Initial baseline

20 Jun 17:51

Choose a tag to compare

First tagged snapshot of this project. Highlights:

  • Rotated Tesla and Nature Remo credentials after discovering hardcoded secrets in early PoC scripts; scrubbed git history.
  • Reorganized throwaway verification scripts into poc/, genericized with environment variables (poc/.env) so others can adapt them.
  • Documented the actual Tesla/Nature Remo onboarding steps, the charging-amps feedback control algorithm, and a security-incident runbook.
  • Added a --force-run mode for testing charge logic outside daylight hours.
  • Cleaned up stylistic quirks left over from early development with Google Gemini.

v0.1.0 - 初期ベースライン

このプロジェクト最初のタグ付きスナップショットです。主な内容:

  • 初期の実証用スクリプトにハードコードされていたTesla/Nature Remoの認証情報の漏洩を発見し、ローテーション・Git履歴の除去を実施。
  • 使い捨ての検証スクリプトを poc/ に整理し、環境変数(poc/.env)で汎用化。
  • Tesla/Nature Remoの実際のオンボーディング手順、充電電流のフィードバック制御ロジック、セキュリティインシデント対応手順をドキュメント化。
  • 夜間でも充電ロジックを検証できる --force-run モードを追加。
  • 開発初期に残っていたGoogle Geminiの表現上の癖を整理。