teslamate-custom-dashboards

Custom grafana dashboards for Teslamate

00Updated 11/02/2026

TeslaMate Custom Grafana Dashboards

Custom Grafana dashboards for TeslaMate, optimized for Tesla Model Y Juniper RWD (LFP battery).

Dashboards

DashboardDescription
Battery Degradation (LFP)Capacity estimation, health %, degradation scatter plot, projected range
Charging CostsMonthly breakdown, cost by location type, cumulative cost, charging efficiency
Driving EfficiencyWh/km analysis, temperature & speed correlation, cold-battery protection
Vampire DrainParking drain tracking, sleep ratio correlation, power draw analysis
Tire PressureTPMS gauges for all 4 tires, pressure history over time

Prerequisites

  • TeslaMate running with PostgreSQL and Grafana (standard docker-compose setup)
  • Docker and docker-compose installed

Installation

1. Clone this repository on your server

cd ~
git clone https://github.com/YOUR_USERNAME/teslamate-custom-dashboards.git

2. Add volume mounts to your docker-compose.yml

Add two lines to the volumes section of your grafana service:

services:
  grafana:
    image: teslamate/grafana:latest
    # ... existing config ...
    volumes:
      - teslamate-grafana-data:/var/lib/grafana
      # Add these two lines:
      - ~/teslamate-custom-dashboards/provisioning/custom-dashboards.yml:/etc/grafana/provisioning/dashboards/custom-dashboards.yml
      - ~/teslamate-custom-dashboards/dashboards:/custom-dashboards

3. Restart Grafana

docker compose restart grafana

The dashboards will appear in Dashboards > Custom Dashboards folder after ~15 seconds.

4. (Optional) Install SQL views

The dashboards reference custom SQL views for complex queries. Install them:

docker compose exec -T database psql -U teslamate -d teslamate < ~/teslamate-custom-dashboards/sql/custom_views.sql

You should see CREATE VIEW and CREATE INDEX output for each object.

Note: These views must be re-created after a TeslaMate database restore (DROP SCHEMA public CASCADE destroys them). Just re-run the command above.

LFP vs NCM Battery

The Battery Degradation dashboard uses the LFP capacity formula:

Capacity = (100 x charge_energy_added) / (max_SOC - min_SOC)

If you have a Long Range model (NCM battery), replace the battery queries with the NCM formula:

SELECT AVG(
  c.rated_battery_range_km * cars.efficiency / c.usable_battery_level
) AS capacity_kwh
FROM charging_processes cp
INNER JOIN charges c ON c.charging_process_id = cp.id
INNER JOIN cars ON cp.car_id = cars.id
WHERE cp.car_id = $car_id
  AND c.usable_battery_level > 0
ORDER BY cp.end_date DESC
LIMIT 10;

SQL Views

The sql/custom_views.sql file creates 6 views:

ViewPurpose
custom_battery_capacity_lfpLFP capacity from energy added / SOC delta
custom_monthly_charging_costsMonthly cost, kWh, sessions, efficiency
custom_charging_by_typeHome / Supercharger / Work / Public classification
custom_drive_efficiencyPer-drive Wh/km with cold-battery guard
custom_vampire_drainParking gaps with drain rate and sleep ratio
custom_tire_pressure_latestMost recent TPMS reading per car

Plus 3 performance indexes on charging_processes, drives, and positions.

Troubleshooting

Dashboards don't appear

# Check Grafana can see the provisioning file
docker compose exec grafana ls /etc/grafana/provisioning/dashboards/

# Check dashboards are mounted
docker compose exec grafana ls /custom-dashboards/

# Check Grafana logs
docker compose logs grafana | grep -i custom

"No Data" in panels

  • Adjust the time range (top-right) to cover periods with driving/charging data
  • Verify the Car dropdown is set correctly
  • Tire pressure: TPMS data isn't always available; try a wider time range
  • Battery degradation: needs at least a few charging sessions with > 5% SOC change

SQL view errors

If panels show relation "custom_battery_capacity_lfp" does not exist:

# Re-run the views
docker compose exec -T database psql -U teslamate -d teslamate < ~/teslamate-custom-dashboards/sql/custom_views.sql

# Verify they exist
docker compose exec database psql -U teslamate -d teslamate -c "\dv custom_*"

Editing dashboards

All dashboards have allowUiUpdates: true. You can edit directly in Grafana. To persist changes across container recreation, export the JSON and save it back to the dashboards/ directory.

References

License

MIT