Skip to content

feat(charging): sync Supercharger costs from Tesla history - #5634

Open
BZHugs wants to merge 2 commits into
teslamate-org:mainfrom
BZHugs:feat/supercharger-cost-sync
Open

feat(charging): sync Supercharger costs from Tesla history#5634
BZHugs wants to merge 2 commits into
teslamate-org:mainfrom
BZHugs:feat/supercharger-cost-sync

Conversation

@BZHugs

@BZHugs BZHugs commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • add a native Tesla charging-history GraphQL client
  • automatically backfill missing Supercharger costs for every vehicle
  • periodically check recent sessions every 90 minutes
  • preserve manually entered or geofence-calculated costs
  • support explicit zero-cost sessions and multiple fee components

The feature is opt-in with:

ENABLE_TESLA_CHARGING_COST_SYNC=true

This addresses the feature discussed in:

#1831
#3266

Testing

  • GraphQL authentication, pagination and error handling
  • fee and zero-cost normalization
  • time and energy-based session matching
  • multi-vehicle synchronization and retry behavior
  • existing-cost protection
  • live Tesla charging-history request

AI assistance

Parts of this implementation and its tests were drafted with AI assistance, then reviewed and verified by me.

@CLAassistant

CLAassistant commented Aug 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@netlify

netlify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploy Preview for teslamate ready!

Name Link
🔨 Latest commit 2ab8785
🔍 Latest deploy log https://app.netlify.com/projects/teslamate/deploys/6a84a239d80ff40008f19b55
😎 Deploy Preview https://deploy-preview-5634--teslamate.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@JakobLichterfeld JakobLichterfeld added the note:discussion Details or approval are up for discussion label Aug 18, 2026
@JakobLichterfeld

JakobLichterfeld commented Aug 18, 2026

Copy link
Copy Markdown
Member

Thanks for your contribution JOUET. This is a much aksed feature.
Before looking any deeper into it, the architecture or anything else:

Using an AI assistant is fine — but please review and run its output yourself before submitting, and be transparent about it in the PR description (e.g. a short "tests drafted with , reviewed and verified by me" note). Reviewing code the author hasn't run or reviewed shifts the verification cost onto the maintainers.

If the CI fails in the first verification step this is a big hint, nothing has been checked on your end. Please see
https://docs.teslamate.org/docs/development

@JakobLichterfeld
JakobLichterfeld marked this pull request as draft August 18, 2026 16:54
@BZHugs

BZHugs commented Aug 18, 2026

Copy link
Copy Markdown
Author

Yes, you're right, I was too quick to open the PR.

This feature started as a side project I originally wrote in Python, running in a separate Docker container alongside TeslaMate. I asked GPT to port that code directly into the TeslaMate codebase, and I submitted the PR without running the CI locally first.

I'll take some time to properly review the generated changes and fix the CI issues. At first glance, it looks like it's mainly linting, but I'll go through everything before pushing further changes.

I'll also update the PR description to be transparent about the use of AI.

Thanks for pointing this out.

@BZHugs
BZHugs marked this pull request as ready for review August 18, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

note:discussion Details or approval are up for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants