π Fork Overview & Enhancements
This fork extends the official Tesla reference implementation into a complete, production-ready observability stack. It transforms the raw telemetry receiver into an end-to-end analytics platform with a TimescaleDB backend, predictive diagnostics across 11 vehicle subsystems, and 15 pre-built Grafana dashboards β served behind nginx mTLS.
Key Additions:
- PostgreSQL / TimescaleDB Dispatcher: A custom Go datastore module (
datastore/postgres/) that writes incoming telemetry directly into TimescaleDB with continuous aggregates, compression, and 5-year retention.- 17 SQL Migrations: Schema, views, unit-conversion functions, GPS-based trip sessionisation, charge session detection, and full predictive diagnostics for battery, drivetrain, heat pump, suspension, brakes, PCS, air suspension, dual motor, and Cybertruck subsystems (
deploy/sql/).- Predictive Health Engine: Cross-subsystem risk scoring (
predictive_health_summaryview) that weights 11 subsystems into a single 0β100 risk score with recommended actions.- 15 Grafana Dashboards: Pre-provisioned via Docker Compose with auto-discovery β see screenshots below.
- Telemetry Simulator: Generates realistic 90-day synthetic history for dashboard development without a real vehicle (
tools/simulator/).- Extensive Deployment Runbook: Covers Let's Encrypt + nginx mTLS, EC keypair generation, Tesla Developer API registration, virtual key pairing, and DNS automation (
deploy/README.md).
β οΈ Experimental features: The Predictive Health Engine (SQL views indeploy/sql/014β017) and the Telemetry Simulator (tools/simulator/) are early-stage beta features. Diagnostic scores and wear estimates may be inaccurate β do not rely on them for safety or maintenance decisions without independent verification.
Layer Upstream This Fork Ingest Go mTLS WebSocket server Same β no core protocol changes Persistence Kafka, Kinesis, Pub/Sub, MQTT, ZMQ + PostgreSQL / TimescaleDB Schema & Analytics None + Hypertables, PostGIS, trip views, unit-conversion SQL functions Visualisation None + 15 Grafana dashboards (Overview, Predictive Health, Energy, Alerts, etc.) Testing Basic integration tests + Synthetic telemetry simulator covering all 239 vehicle fields Deployment Helm chart reference + Docker Compose stack + full operator runbook Production Server (Ubuntu + UFW) βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β Nginx (HTTPS / Let's Encrypt / EC Key Serving) β Owner (Browser) ββ HTTPS :443 ββΌββΊ β β β β β β Docker Compose Stack β β β βββββββββββββββββββββββββββββββββββββββββββ β β ββββββΊβ Grafana (:3003) β β β β β² β β β β β (SQL Views & Dashboards) β β β β βΌ β β β β TimescaleDB (PostgreSQL + PostGIS) β β β β β² β β β β β (Raw Telemetry Insert) β β β β β β β Tesla Vehicle ββββ mTLS :4443 ββΌβββββββββΊβ fleet-telemetry (Go) β β β βββββββββββββββββββββββββββββββββββββββββββ β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- TimescaleDB stores every telemetry field as a single hypertable with composite PK
(ts, vin, field). PostGIS handles GPS points. Compression is enabled (7-day chunks).- PostgreSQL dispatcher is a first-class
telemetry.Producer(~550 LOC, with integration tests). It unmarshals protobuf records, handles numeric/string/geo types, and writes in batches.- SQL analytics layer lives in
deploy/sql/:
001_schema.sqlβ hypertable, indexes, PostGIS002_views.sqlβ trip detection via GPS time-gap sessionization, energy per trip (kWh, Wh/km), battery drain, speed stats; pivotable user-preference views for dynamic unit conversion003_grafana_role.sqlβ read-only DB user for Grafana004_field_catalog.sqlβ searchable field metadata- Grafana dashboards use query variables (VIN selector, time range) and call SQL helper functions (
to_dist,to_temp) so the same dashboard works for metric or imperial vehicles.- Simulator (
tools/simulator/) generates realistic driving/charging data directly into TimescaleDB, letting you develop and demo dashboards without owning a Tesla or exposing a public endpoint.
- Single hypertable, EAV-style β One
(ts, vin, field, num_value, str_value, geo_value)table instead of dozens of typed tables. This matches the streaming protobuf schema and makes adding new vehicle fields zero-downtime.- Trip detection in SQL β Rather than maintaining stateful session logic in Go, trips are derived via a SQL window function that detects >5-minute GPS gaps. This makes the definition inspectable, versioned, and easy to tune.
- Unit conversion at query time β The car reports its preferred units as telemetry fields. Grafana reads the latest preference per VIN and passes it into SQL functions. No hard-coded units in the dashboards.
- Two-domain architecture β
tesla.example.comserves the mTLS fleet endpoint;ft.example.comserves the static EC public key for Tesla partner registration. This isolates the public-key serving requirement from the telemetry port.
For the original Tesla Fleet Telemetry documentation (covering the Go ingest server architecture, Kinesis/PubSub configurations, and core protocol details), please see docs/UPSTREAM.md.
This project is licensed under the Apache License 2.0.
- The original Go ingest server is copyright Β© 2024 Tesla, Inc.
- The Predictive Health engine, PostgreSQL/TimescaleDB analytics, and Grafana dashboards are copyright Β© 2026 Piotr Godlewski.










