Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

TeslaMate [megathread]

This site may earn commission on affiliate links.
Is there any housekeeping that needs doing to compress/clean up the Teslamate database? I'm backing it up daily and after owning the car 2 years its now at 701MB daily
Nothing short of simply dropping the database and starting fresh. That size for two years of ownership sounds about right. It all depends on how much you drive. Curious, what is your mileage in those two years?
 
thanks, would that make any difference to the size? Actually 1.6 years, got the car March 22, on 21k miles.
If you start with a fresh database and "archive" the current state, yes as the database would be zero. But you lose looking at the archived data in Grafana. Give and take. What are you running TeslaMate on? And is storage a concern?

Also what @init6 said 😊
 
  • Like
Reactions: init6
I'm running Teslamate in containers on Linux via docker-compose. My script is just a slight variation of the command shown in the documentation:
Code:
docker-compose exec -T database pg_dump -U teslamate teslamate | gzip > /backuplocation/teslamate-db.gz

To run it regularly, I simply have that line in an executable shell script in /etc/cron.daily. Until recently, I was running Docker on Windows, where my backup job was a very similar Powershell script set up to run as a Scheduled Task. (Notably, I verified that my backup & restore processes worked when I moved Teslamate from one computer to the other.)

I have a separate daily script that copies the .gz file (and a bunch of other stuff) to a different computer on my local network, which in turn has its own (more robust) backup capability. Storage isn't a big concern for me, but I figured the uncompressed file will continue to grow quickly, and the extra compute power required to gzip is relatively small.

Note that the restore command would also be slightly different from what's in the documentation:
Code:
gunzip /restorelocation/teslamate-db.gz | docker-compose exec -T database psql -U teslamate -d teslamate

And of course those code snippets expect that docker-compose and gzip and gunzip are in your executable path.
 
  • Love
Reactions: cwanja
If you start with a fresh database and "archive" the current state, yes as the database would be zero. But you lose looking at the archived data in Grafana. Give and take. What are you running TeslaMate on? And is storage a concern?
yeah don't want to lose data! I'm on a Pi, no issues with space there, but I move it to a free Dropbox account that has limited space, the gzip solution adding to my script seems the perfect answer.

This is the script I've been using (seems to have gone from it's origional home) Automatic Backup to Dropbox on Raspberry Pi Tutorial (archive.org)
 
  • Like
Reactions: cwanja
I'm running Teslamate in containers on Linux via docker-compose. My script is just a slight variation of the command shown in the documentation:
Code:
docker-compose exec -T database pg_dump -U teslamate teslamate | gzip > /backuplocation/teslamate-db.gz

To run it regularly, I simply have that line in an executable shell script in /etc/cron.daily. Until recently, I was running Docker on Windows, where my backup job was a very similar Powershell script set up to run as a Scheduled Task. (Notably, I verified that my backup & restore processes worked when I moved Teslamate from one computer to the other.)

I have a separate daily script that copies the .gz file (and a bunch of other stuff) to a different computer on my local network, which in turn has its own (more robust) backup capability. Storage isn't a big concern for me, but I figured the uncompressed file will continue to grow quickly, and the extra compute power required to gzip is relatively small.

Note that the restore command would also be slightly different from what's in the documentation:
Code:
gunzip /restorelocation/teslamate-db.gz | docker-compose exec -T database psql -U teslamate -d teslamate

And of course those code snippets expect that docker-compose and gzip and gunzip are in your executable path.
Thank you!
 
Anyone seen a good home assistant setup doc around?
I've got both installs setup with docker but i don't see many good notes on how to set this up.

The only integration that I think would be useful is the Garage Door Automation
I'm running Home Assistant within the same instance of Docker as TeslaMate, but I don't integrate the two directly with each other. Instead I'm using the "Tesla Custom Integration" component via HACS:

TeslaMate docs do include instructions on Home Assistant integration via MQTT, but I haven't tried it:

And it looks like there's a custom Home Assistant add-on for TeslaMate, which can't be used when running HA in Docker, so I haven't tried that either:
 
Can anyone explain how to use Teslamate/Grafana with two cars? Dashboard only seems to show data for one car and I can't find anywhere to select the other car even though both show up on the Teslamate homepage
Thats odd as I get my old car and my current car on the dashbaords, one below the other. I had to google how to deleted my old car which involved executing a SQL command.
 
1695378296870.png

That's what I get on Grafana. Can't see any option to select a specific car.

Teslamate does definitely see both cars
1695378440396.png