TeslaMate

Self-hosted Tesla data logger collecting vehicle telemetry from the Tesla API.

Quick Reference

PropertyValue
URLhttps://tesla.ops.eblu.me
ArgoCD appteslamate-ringtail (ringtail k3s)
Namespaceteslamate
Imageregistry.ops.eblu.me/blumeops/teslamate (see argocd/manifests/teslamate-ringtail/kustomization.yaml for current tag)
Databasepostgresql — CNPG blumeops-pg on ringtail, in-cluster at blumeops-pg-rw.databases.svc.cluster.local

Data Collected

  • Battery level, state of charge, range estimates
  • Charging sessions (location, energy, cost, duration)
  • Drives (distance, efficiency, routes)
  • Climate/HVAC usage
  • Software update history
  • Vampire drain analysis
  • Vehicle states (asleep, driving, charging, online)

Grafana Dashboards

18 dashboards in the “TeslaMate” folder:

  • Overview, Charges, Drives, Efficiency, States
  • Battery Health, Vampire Drain, Statistics
  • Charge Level, Locations, Trip, Mileage
  • Drive Stats, Charging Stats, Projected Range
  • Timeline, Updates, Visited

Dashboards use PostgreSQL datasource (not Prometheus). The Grafana datasource connects as the teslamate database user via the Caddy L4 route pg.ops.eblu.me:5434 → blumeops-pg-ringtail.

The dashboard files are not in this repo: a Grafana init container fetches them at startup from the mirrors/teslamate forge mirror at a pinned tag (version in argocd/manifests/grafana-ringtail/deployment.yaml — bump TESLAMATE_VERSION there to update the set).

Database Permissions

The teslamate role was initially provisioned as superuser to allow extension creation (cube, earthdistance) during initial setup. Superuser has been removed — teslamate is now a plain database owner with extension ownership transferred so it can ALTER EXTENSION ... UPDATE without superuser.

Note: earthdistance is not a trusted extension in PostgreSQL, so CREATE EXTENSION earthdistance still requires superuser. If a future TeslaMate migration does DROP EXTENSION ... CASCADE + re-create (as happened in the 2024 migration), it will fail. In that case, temporarily grant superuser for the migration and remove it afterward.

Extension ownership persists across pod restarts and CNPG failovers, but a full cluster rebuild (major PG upgrade, fresh initdb) would re-create extensions as postgres. After any rebuild, transfer ownership back:

UPDATE pg_extension SET extowner = (SELECT oid FROM pg_roles WHERE rolname = 'teslamate') WHERE extname IN ('cube', 'earthdistance');

Authentication

Uses Tesla Owner API via OAuth:

  1. Access https://tesla.ops.eblu.me
  2. Click “Sign in with Tesla”
  3. Tokens encrypted with ENCRYPTION_KEY

Credentials

1Password: TeslaMate item with db_password and api_enc_key