https://github.com/ev-dev-labs/teslasync
๐ Self-hosted Tesla Fleet Intelligence Platform โ real-time monitoring, analytics, remote commands, and 30+ interactive dashboards. โ โ Built with Go, React, PostgreSQL, and Helm.
https://github.com/ev-dev-labs/teslasync
data-logger ev fleet-api go helm homelab kubernetes react self-hosted tesla tesla-api
Last synced: 28 days ago
JSON representation
๐ Self-hosted Tesla Fleet Intelligence Platform โ real-time monitoring, analytics, remote commands, and 30+ interactive dashboards. โ โ Built with Go, React, PostgreSQL, and Helm.
- Host: GitHub
- URL: https://github.com/ev-dev-labs/teslasync
- Owner: ev-dev-labs
- Created: 2026-03-22T02:32:23.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-08T00:13:12.000Z (2 months ago)
- Last Synced: 2026-04-08T02:32:16.077Z (2 months ago)
- Topics: data-logger, ev, fleet-api, go, helm, homelab, kubernetes, react, self-hosted, tesla, tesla-api
- Language: TypeScript
- Homepage:
- Size: 10.4 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: docs/contributing/adding-features.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
TeslaSync
Self-hosted Tesla fleet intelligence โ with Helix AI built in.
Telemetry, analytics, automation, remote control, and an opt-in AI assistant for one car or a fleet โ all on infrastructure you control.
What it does โข
Helix AI โข
Remote control โข
Quick start โข
Architecture โข
Documentation โข
Contributing
---
## What it does
TeslaSync is a self-hosted platform that turns your Tesla data into a real
product: ingestion, history, dashboards, alerts, automations, remote commands,
and an optional AI assistant called **Helix**. Everything runs in Docker or
Kubernetes on hardware you control. Your telemetry never leaves your network
unless you choose to send it somewhere.
### At a glance
| | |
|---|---|
| Backend | Go 1.25 ยท Chi v5 ยท pgx v5 ยท zerolog ยท Prometheus ยท OpenTelemetry |
| Frontend | React 18 + TypeScript ยท Vite 5 ยท TanStack Query 5 ยท Tailwind ยท Framer Motion ยท i18next |
| Storage | PostgreSQL 17 + TimescaleDB ยท pgvector ยท Redis 7 |
| Streaming | Tesla Fleet Telemetry (gRPC) ยท MQTT ยท SSE ยท polling fallback |
| Deployment | Docker Compose (13 services) ยท Helm chart |
| Vehicle control | 65+ Tesla command endpoints via Fleet API or Vehicle Command Proxy |
| AI | **Helix** โ 54 opt-in user features powered by a pluggable provider chain |
| Schema | 197 numbered SQL migrations ยท TimescaleDB hypertable for `signal_log` |
| Frontend feature areas | 21 (admin, analytics, automations, battery, charging, dashboard, diagnostics, driving, exports, maps, notifications, onboarding, power-user, settings, sharing, system, telemetry, trips, vehicle-systems, vehicles, watch) |
---
## Helix AI
Helix is TeslaSync's optional AI layer. The brand mark (`HelixMark`) appears
anywhere AI is in play โ sidebar nav, chatbot avatar, feature badges, AI
settings header.
> **Off by default, opt-in per feature.** There is no global "AI on" switch.
> Each Helix feature is individually enabled from **Settings โ AI**. Disabled
> features are *invisible*: their HTTP routes return 404, their React routes
> mount no AI UI, their background jobs and push notifications never fire.
### Surfaces
| Surface | Route | What it is |
|---|---|---|
| **Helix Chat** | `/chatbot` | Conversational assistant with tool-use over your fleet data |
| **AI Settings** | `/settings/ai` | Per-feature toggles, provider config, usage card, redaction controls |
| **AI Usage Card** | `/settings/ai` | Per-call audit log + spend visualisation across providers |
| **AI Restore Panel** | `/settings/ai` | Re-issue a past AI answer from the audit log |
| **Inline AI components** | various pages | 55+ `AI*.tsx` widgets gated by `withAiFeature` |
### The 54 features (grouped)
**Narratives & summaries**
Weekly digest narration ยท Year-in-review narration ยท Period-compare narration ยท
TCO narration ยท Cost-forecast narration ยท Battery-health forecast narrative ยท
Cabin-temperature impact narrative ยท Vampire-drain explanation
**Natural-language builders**
NL alert rule builder ยท NL automation builder ยท NL dashboard composer ยท
NL Grafana panel builder ยท NL SQL playground ยท NL drive search & replay ยท
NL signal-explorer filter ยท NL search
**Predictions & ML**
Range prediction model ยท Predictive maintenance ยท Smart charge schedule ยท
Preheat / precool recommender ยท Charging-curve fingerprint clustering ยท
ML charging-curve clustering ยท Learned per-vehicle anomaly baselines
**Explainers & coaching**
Drive coaching ยท Safety-setting explainer ยท Anomaly explanations ยท
MQTT / SSE inspector explanations ยท State-machine debugger narrator ยท
Log / trace summarization ยท Software-update changelog summarizer ยท
Incident timeline summarizer ยท Charging diagnosis ยท Speed-profile insights ยท
Route-efficiency suggestions ยท Tire-pressure trend reasoning
**Automation & operations**
Alert-tuning suggestions ยท Cross-rule conflict detection ยท Quiet-hours
suggestion ยท Inbox auto-categorization ยท Feedback-queue triage ยท
Data-repair suggestions ยท Geofence-aware automation suggestions ยท
Suggest new geofences ยท Auto-name unnamed locations ยท Auto trip naming
**Multimodal & misc**
Voice mode ยท Watch-face NL response ยท Trip planner LLM agent ยท
Trip postcard share-card image generation ยท Vehicle paint preview ยท
PII redaction for shared exports ยท RAG help ยท Lifetime stats Q&A ยท
Chatbot LLM
Plus 3 ops-only features: AI Usage Card, AI Provider Health, AI Redaction
Bypass Report โ also off by default.
### How Helix stays trustworthy
- **Single source of truth** โ every feature lives in
`internal/ai/features/registry.go`. Adding a feature means adding an entry,
not touching the form. The frontend mirror `web/src/ai/features.ts` is
**generated** by `tools/aigen`; CI runs `go run ./tools/aigen --check` and
blocks merge if the two drift.
- **Off-by-default contract** โ verified by `tools/aivet` and a final-gate
test suite. Every surface (HTTP route, React route, background job, push
kind) is enumerated in the registry and walked in CI to assert that
`ai_mode='off'` produces 404s, no DOM nodes carrying `data-ai-feature`,
no job execution, and no push delivery.
- **Per-call audit log** โ every invocation is recorded with feature ID,
provider, latency, token counts, and redaction status. Visible in the
AI Usage Card.
- **Outbound PII redaction** โ every request passes through an F8 redact
decorator before leaving the network. Per-(feature, provider) bypass
events are surfaced in the Redaction Bypass Report.
- **Pluggable provider chain** โ adapters for OpenAI, Azure OpenAI,
Anthropic, and local Ollama; primary + fallback configurable per feature.
- **Strict per-feature gate** โ `g.Wrap("", handler)` wraps every
route; `withAiFeature("")` wraps every React component;
`aivet` refuses to build if either is missing.
Full Helix documentation: [`docs/guide/helix-ai.md`](docs/guide/helix-ai.md).
---
## Remote vehicle control
TeslaSync exposes **65 unique Tesla Fleet API command endpoints** organised by
domain. Commands that require Tesla's signed-command envelope (Model 3/Y from
2021+, all Model S/X refresh, all Cybertruck) are routed automatically through
a [Vehicle Command Proxy](https://github.com/teslamotors/vehicle-command) when
one is configured; `wake_up` always goes direct to Fleet API.
| Category | Endpoints | Examples |
|---|---:|---|
| Wake | 1 | `wake_up` |
| Security & access | 10 | `door_lock`, `door_unlock`, `set_sentry_mode`, `speed_limit_activate/deactivate/set_limit/clear_pin/clear_pin_admin`, `guest_mode`, `erase_user_data` |
| Valet & PIN-to-drive | 5 | `set_valet_mode`, `reset_valet_pin`, `set_pin_to_drive`, `reset_pin_to_drive_pin`, `clear_pin_to_drive_admin` |
| Climate | 3 | `auto_conditioning_start/stop`, `set_temps` |
| Seat & steering heat | 6 | `remote_seat_heater_request`, `remote_seat_cooler_request`, `remote_auto_seat_climate_request`, `remote_steering_wheel_heater_request`, `remote_steering_wheel_heat_level_request`, `remote_auto_steering_wheel_heat_climate_request` |
| Climate protection | 7 | `set_bioweapon_mode`, `set_cabin_overheat_protection` (incl. fan-only), `set_cop_temp`, `set_climate_keeper_mode` (Off / Keep / Dog / Camp), `set_preconditioning_max` |
| Charging | 8 | `charge_port_door_open/close`, `charge_start`, `charge_stop`, `set_charge_limit`, `set_charging_amps`, `charge_max_range`, `charge_standard` |
| Trunk & frunk | 1 | `actuate_trunk` (`which_trunk=front` or `rear`) |
| Alerts | 2 | `honk_horn`, `flash_lights` |
| Boombox | 1 | `remote_boombox` (fart, ping, custom) |
| Windows & sunroof | 2 | `window_control` (vent / close), `sun_roof_control` (vent / close / stop) |
| HomeLink | 1 | `trigger_homelink` |
| Remote start | 1 | `remote_start_drive` |
| Media | 7 | `media_toggle_playback`, `media_next_track`, `media_prev_track`, `media_next_fav`, `media_prev_fav`, `media_volume_down`, `adjust_volume` |
| Charge & precondition schedules | 6 | `add_charge_schedule`, `remove_charge_schedule`, `add_precondition_schedule`, `remove_precondition_schedule`, `set_scheduled_charging`, `set_scheduled_departure` |
| Navigation | 3 | `navigation_request`, `navigation_gps_request`, `navigation_sc_request` |
| Software updates | 2 | `schedule_software_update`, `cancel_software_update` |
| Vehicle metadata | 1 | `set_vehicle_name` |
Full per-command reference (friendly aliases, parameters, signing
requirements): [`docs/guide/remote-commands.md`](docs/guide/remote-commands.md)
and source of truth `internal/tesla/client_commands.go`.
---
## Real-time telemetry
- **Tesla Fleet Telemetry** โ gRPC streaming. The vendored `vehicle_data.proto`
plus `go generate` keep the codec, signal metadata, and routing table in
lock-step with upstream.
- **MQTT** โ publish / subscribe to live signals; embedded Mosquitto in
Docker Compose, any external broker via Helm.
- **SSE** โ Server-Sent Events push live state to the browser. Singleton
connection per tab, automatic reconnect, instant vehicle + alert updates.
- **Polling fallback** โ `/api/1/vehicles/{id}/vehicle_data` on a schedule
when streaming is unavailable.
- **Two-layer signal store**
- L1: in-process `signal.Store` (nanosecond reads, FSM / sessions hot path)
- L2: Redis `vehicle:{id}:signals` HSET + Pub/Sub (cross-pod, restart recovery)
- Durable history: `signal_log` TimescaleDB hypertable (every signal kept
forever for charts, replay, and point-in-time reconstruction)
---
## Features
### Operations & fleet
Dashboard ยท Live map with 5 tile layers (CARTO Dark default, Azure Maps,
Google Maps, Esri Satellite, OpenStreetMap, OpenTopoMap) ยท Vehicle detail ยท
Command history ยท State-machine timeline ยท Command palette (Cmd/Ctrl+K) ยท
PWA installable ยท 5 dynamic themes ร 4 display modes
### Charging
Sessions ยท Charging curve ยท Cost analysis ยท Charging heatmap (7ร24) ยท
Tesla billing history ยท Charge limit & amp control ยท Schedules (legacy +
firmware 2024.26+) ยท Preconditioning
### Energy & battery
Battery health ยท Cell voltage spread (4ร23 pack visualisation) ยท
Pack voltage / current ยท BMS ยท Powershare ยท Vampire drain ยท Energy flow ยท
Degradation projection with linear regression
### Driving
Drive list ยท Drive detail ยท Drive Score (0โ100 efficiency) ยท Speed profile ยท
Motor torque ยท G-forces ยท Pedal usage ยท Stator / inverter / heatsink temps ยท
Trip replay (animated) ยท Route efficiency comparison ยท Regen ratio
### Analytics
Monthly statistics ยท True cost of ownership (EV vs gas) ยท Sleep efficiency ยท
Temperature impact (efficiency vs ambient) ยท Weekly digest ยท Year-in-review ยท
Projected range under different conditions (highway, city, cold, hot, sentry) ยท
Fleet comparison
### Alerts & automation
**Alert Studio** at `/alert-studio` โ visual rule builder over the full Tesla
signal catalog (230 entries). **CEP rule engine** with recursive AND/OR/NOT
condition trees, 11 operators, `for_seconds` temporal sustain,
`changed_to`/`changed_from` transition detection, per-rule cooldown,
multi-channel dispatch, server-side quiet hours, 50+ rule templates,
test-notification flow with signal-value interpolation
(`{{BatteryLevel}}` etc.).
### Diagnostics & developer tools
Live signal monitor ยท Signal log viewer ยท Signal explorer (chart any signal) ยท
Signal diff ยท Signal gap detector ยท State-machine debugger ยท MQTT inspector ยท
DB health dashboard ยท 25+ Tesla API developer tools (VIN decoder, JWT decoder,
partner registration, API playground, raw fleet-telemetry config / errors,
signal config modal, โฆ)
### Backup & restore
Scheduled automated backups (daily to every 30 days) ยท Full + incremental ยท
Multi-provider storage (Local, Amazon S3, Azure Blob, Google Cloud Storage) ยท
Gzip + SHA-256 integrity verification ยท Configurable retention (last N,
max 100) ยท Download, verify, preview restore from UI ยท Complete run history ยท
One-click manual quick backup
### Maps & geocoding
Multi-provider map tiles with auto-selection by API key ยท Layer switcher on
all 5 map pages ยท Geocoding priority: geofence name โ places cache โ
Google/Azure/Nominatim ยท Places cache (~90% API call reduction) ยท
Reverse-geocoded drives and charging sessions
### Observability
Prometheus `/metrics` ยท 28 Grafana dashboards (deep analytics, CEP, SSE
real-time, infrastructure) ยท OpenTelemetry instrumentation (OTLP gRPC export) ยท
Jaeger profile in Docker Compose ยท Structured zerolog JSON logs ยท
Per-repo DB spans with semantic conventions
### Engineering invariants
- **SI canonical** โ every DB column, API field, and Go/TS type stores SI
units (m, m/s, ยฐC, Pa, Wh). User display preference (mi/km, ยฐF/ยฐC, psi/bar)
is applied **only at the React render boundary** by `useUnits()` /
`useFormatting()`. No legacy unit converters downstream.
- **100% Tesla Fleet Telemetry coverage** โ vendored proto + `go generate`.
- **Auto-generated AI feature mirror** โ backend and frontend cannot drift
on the set of Helix feature IDs.
---
## Quick start
```bash
git clone https://github.com/ev-dev-labs/teslasync.git
cd teslasync
cp .env.example .env
# Edit .env with Tesla Developer credentials and your deployment URLs
docker compose up -d --build
```
Windows users: replace `cp .env.example .env` with `Copy-Item .env.example .env`.
Default ports:
| Service | URL |
|---|---|
| Web UI | http://localhost:3000 |
| API | http://localhost:8080 |
| Grafana | http://localhost:3001 |
| Prometheus | http://localhost:9099 |
| Jaeger (optional, `--profile tracing`) | http://localhost:16686 |
### What the quick start actually gives you
`docker compose up -d --build` brings up the stack in **open mode** (no `FORWARD_AUTH_HEADER` set) โ fine for a local trial on `localhost`, **not** safe to expose publicly. The Tesla OAuth flow needs all five scopes ticked on your Tesla Developer application (`openid offline_access vehicle_device_data vehicle_location vehicle_cmds vehicle_charging_cmds`); any missing scope produces a working-looking dashboard with empty vehicle pages. The compose file uses `timescale/timescaledb-ha:pg17` because migration 1 installs TimescaleDB + pgvector โ upstream `postgres:17` will fail to start.
For Fleet Telemetry streaming or signed commands you also need:
- A publicly-reachable HTTPS domain with valid TLS
- A registered partner account with Tesla (one-time `POST /api/v1/devtools/register-partner` once the public domain is live)
- The `commands` and/or `telemetry` Compose profiles enabled
Full step-by-step setup including the auth model decision, partner-key flow, regional Fleet API bases, and Helix AI provider choices:
[`docs/guide/getting-started.md`](docs/guide/getting-started.md) ยท [`docs/guide/tesla-fleet-api.md`](docs/guide/tesla-fleet-api.md).
---
## Architecture
```
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Browsers โ
โ React SPA + PWA โ
โโโโโโโโโโโฌโโโโโโโโโโโโโ
โ HTTPS / SSE
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Go API (Chi v5) โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Vehicle ops โ โ Helix AI router โ โ
โ โ Telemetry โ โ โข feature gate โ โ
โ โ Charging โ โ โข redact decorator โ โ
โ โ Alerts / CEP โ โ โข provider chain โ โ
โ โ Automations โ โ โข per-call audit โ โ
โ โ Backups โ โ โข tool registry โ โ
โ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโ
โ Postgres โ โ Redis 7 โ โ MQTT โ
โ Timescale โ โ โข L2 store โ โ Mosquittoโ
โ + signal โ โ โข cache โ โโโโโโโโโโโโ
โ _log โ โ โข Pub/Sub โ
โโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โฒ โฒ
โ โ
โโโโโโโดโโโโโโโโโโโโโโโโโโโโดโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ
โ Tesla Fleet Telemetry โ โ Vehicle Command โ
โ gRPC subscriber + codec โ โ Proxy (signs cmds) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโ โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Tesla Fleet API โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
Detail: [`docs/guide/architecture.md`](docs/guide/architecture.md).
---
## Documentation
| | |
|---|---|
| ๐ [Getting started](docs/guide/getting-started.md) | Install, configure, first run |
| ๐ [Tesla Fleet API setup](docs/guide/tesla-fleet-api.md) | Developer app, scopes, regions, partner registration |
| ๐ง [Helix AI](docs/guide/helix-ai.md) | Features, providers, audit, redaction |
| ๐ฎ [Remote commands](docs/guide/remote-commands.md) | All 65 Tesla commands |
| ๐ [Architecture](docs/guide/architecture.md) | Services, data flow, schema |
| โ [Configuration](docs/guide/configuration.md) | Environment variables |
| ๐ก [Fleet Telemetry](docs/guide/fleet-telemetry.md) | gRPC streaming setup |
| ๐ [Database](docs/guide/database.md) | Schema, hypertables, migrations |
| ๐ [API endpoints](docs/guide/api-endpoints.md) | REST + SSE reference |
| ๐ณ [Docker deployment](docs/deployment/docker.md) | Compose setup |
| โธ [Kubernetes](docs/deployment/kubernetes.md) | Helm chart |
| ๐ [Troubleshooting](docs/guide/troubleshooting.md) | Common issues |
| โ [FAQ](docs/guide/faq.md) | |
| ๐ [Local development](docs/guide/local-development.md) | Dev loop |
| ๐ค [Contributing](docs/contributing/code-structure.md) | |
---
## Repository layout
```
.
โโ cmd/ Go entry points (api, workers, tools)
โโ internal/
โ โโ api/ HTTP handlers (incl. 57 ai_*_handler.go files)
โ โโ ai/
โ โ โโ features/registry.go Source of truth for AI features
โ โ โโ strategies/ Per-feature strategy.go + goldens.yaml (53 strategies)
โ โ โโ tools/ Tool registry the LLM can call (50+ tools)
โ โโ tesla/ Fleet API client, 65 command endpoints, proxy router
โ โโ signal/ L1 in-process store
โ โโ fsm/ Vehicle state machine
โ โโ cep/ Complex-event processing for alerts
โ โโ ...
โโ web/
โ โโ src/
โ โโ ai/features.ts Auto-generated from internal/ai/features
โ โโ components/
โ โ โโ ai/ 55+ AI* components, gated by withAiFeature
โ โ โโ branding/ HelixMark โ the Helix brand icon
โ โโ features/ 21 feature areas
โ โโ ...
โโ migrations/ 197 numbered SQL migration files
โโ docs/ User & contributor documentation
โโ helm/teslasync/ Production Helm chart
โโ tools/
โ โโ aigen/ Generates web/src/ai/features.ts from Go registry
โ โโ aivet/ CI vet for AI feature contract
โโ docker-compose.yml 13 services
```
---
## Contributing
See [`docs/contributing/code-structure.md`](docs/contributing/code-structure.md)
and the topical instructions under [`.github/instructions/`](.github/instructions/)
(Go backend, React frontend, Tesla pipeline, telemetry pipeline, observability,
data modeling, i18n, prompt engineering, Helm / Docker).
Before opening a PR:
```bash
# backend
go test ./... -race
go vet ./...
go run ./tools/aivet # AI feature contract check
go run ./tools/aigen --check # ensure web/src/ai/features.ts is in sync
# frontend
cd web
npm install
npm run lint # ESLint + 25+ custom audit scripts
npm run test # Vitest
```
---
## License
MIT โ see [`LICENSE`](LICENSE).
## Acknowledgements
Built on Tesla's [Fleet API](https://developer.tesla.com/docs/fleet-api),
[Fleet Telemetry](https://github.com/teslamotors/fleet-telemetry), and the
[Vehicle Command Proxy](https://github.com/teslamotors/vehicle-command).