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.
OK, you'll need to SFTP to the Pi (either PI IP address or hostname) using your Pi login details, download the latest backup from Google Drive, copy it over using SFTP, then follow the restore section of the backup / restore options page (Backup and Restore | TeslaMate) replacing the filename with the one you've uploaded

Then run docker-compose up -d again to start things up once complete :)

@DaveW - Hi Dave, New member here - I have a restore issue im hoping you can help with please? :)

Using your superb guides, i got TeslaMate up and running, imported supercharger info and even got the Gdrive backups working. I tried to update to the latest 1.21 version last night and totally screwed it up, so did a full reinstall of Raspberry Pi and re installed Teslamate using your guide. Now i want to restore my previous backups but dont have a clue on how to get it done! :(

I have a backup file but have no idea on how to get it restored. Ive tried to follow the guide on the Teslamate Git Hub but it wont restore the backup file - probably as its in the wrong location.
I can SFTP into the PI but not sure where i need to put the backup file from Gdrive?

Please can you help with a step by step dummies guide to restoring as it just dont make sense to me :(
 
I want to set the date format in Grafana to be UK based (DD-MM-YY) rather than the US format currently in use.

I think I'm needing to change/add an environment variable in the YML file, but I'm really way out of my depth - any advice welcome ;).

This doesn't stick between updates, but if you open a root commandline on the grafana container, then run:
Code:
sed -i 's/MM\/DD/DD\/MM/g' /dashboards/*.json
bash -c "find /usr/share/grafana/public -type f -exec sed -i 's@%m/%d@%d/%m@g' {} +"

And also edit the [date_formats] section of /etc/grafana/grafana.ini

It should fix it. You'll probably also need to restart the grafana container.

Cheers,
Tim
 
  • Like
Reactions: spooksman
I should probably add - When i follow the guide on the Github - when trying to create a manual back up i get this:

pi@raspberrypi:~ $ docker-compose exec -T database pg_dump -U teslamate teslamate > /backuplocation/teslamate.bck
-bash: /backuplocation/teslamate.bck: No such file or directory

What am i doing wrong?
 
I should probably add - When i follow the guide on the Github - when trying to create a manual back up i get this:

pi@raspberrypi:~ $ docker-compose exec -T database pg_dump -U teslamate teslamate > /backuplocation/teslamate.bck
-bash: /backuplocation/teslamate.bck: No such file or directory

What am i doing wrong?

Are you specifying a backup folder, or just copying in /backuplocation/ ?
 
Are you specifying a backup folder, or just copying in /backuplocation/ ?

Erm not sure to be honest! Sorry! Im just starting out with Raspberry Pi so not familiar with all the commands :(
im following the guide where it says create a backup file and i get that error
upload_2021-1-3_18-9-35.png
 
Erm not sure to be honest! Sorry! Im just starting out with Raspberry Pi so not familiar with all the commands :(
im following the guide where it says create a backup file and i get that error View attachment 623833
To be honest i just want to restore using my Gdrive backup. But i figured if i tried to create a manual backup using the github guide, then it would create the right folders to add the gdrive restore file into?
Does that make sense?
 
@w3zly looks like you are trying to backup to a non existent folder then. You’d need to make a directory first, (md backupfolder in your user folder).

You don’t need to do that to restore the GDrive backup though, just copy into the location you are in and run the restore process against that file.

Hope that helps :)
 
@w3zly looks like you are trying to backup to a non existent folder then. You’d need to make a directory first, (md backupfolder in your user folder).

You don’t need to do that to restore the GDrive backup though, just copy into the location you are in and run the restore process against that file.

Hope that helps :)
@DaveW - Im so sorry Dave - Complete noob here so need step by step :(

The part i cant figure out is what i need to change in the restore commands to point it to the correct gdrive backup file (im used to Windows file structures) - if it helps, happy to let you remote in to support?

So - which bit do i need to change below? I have the backup file sitting in the root folder
 

Attachments

  • Screenshot 2021-01-03 182138.jpg
    Screenshot 2021-01-03 182138.jpg
    87.9 KB · Views: 95
@DaveW - Im so sorry Dave - Complete noob here so need step by step :(

The part i cant figure out is what i need to change in the restore commands to point it to the correct gdrive backup file (im used to Windows file structures) - if it helps, happy to let you remote in to support?

So - which bit do i need to change below? I have the backup file sitting in the root folder

Sorry - cant figure out how to edit a post yet -

So this is what im following:

# Stop the teslamate container to avoid write conflicts
docker-compose stop teslamate

# Drop existing data and reinitialize
docker-compose exec -T database psql -U teslamate << .
drop schema public cascade;
create schema public;
create extension cube;
create extension earthdistance;
CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
RETURNS public.earth
LANGUAGE SQL
IMMUTABLE STRICT
PARALLEL SAFE
AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$1)))::public.earth';
.

# Restore
docker-compose exec -T database psql -U teslamate -d teslamate < teslamate.bck

# Restart the teslamate container
docker-compose start teslamate

What do i need to change to point it to the correct file?
 
Sorry - cant figure out how to edit a post yet -

So this is what im following:

# Stop the teslamate container to avoid write conflicts
docker-compose stop teslamate

# Drop existing data and reinitialize
docker-compose exec -T database psql -U teslamate << .
drop schema public cascade;
create schema public;
create extension cube;
create extension earthdistance;
CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
RETURNS public.earth
LANGUAGE SQL
IMMUTABLE STRICT
PARALLEL SAFE
AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$1)))::public.earth';
.

# Restore
docker-compose exec -T database psql -U teslamate -d teslamate < teslamate.bck

# Restart the teslamate container
docker-compose start teslamate

What do i need to change to point it to the correct file?

Have you copied the gdrive file onto the Pi @w3zly ? - If your gdrive solution was from my guide, the files wouldn’t be called that (they’d have a day or something custom attached)
 
Have you copied the gdrive file onto the Pi @w3zly ? - If your gdrive solution was from my guide, the files wouldn’t be called that (they’d have a day or something custom attached)
Yes I did copy it from gdrive...it did have Saturday on the end of it but I renamed it when putting it on the pi thinking that was the reason why it wasn't working.
Appreciate any support...I'm losing the will to live with this today!
 
Yes I did copy it from gdrive...it did have Saturday on the end of it but I renamed it when putting it on the pi thinking that was the reason why it wasn't working.
Appreciate any support...I'm losing the will to live with this today!

Got it :)

What happens when you run the restore commands? As if you are running from the home folder that you land in from the Pi, it should be able to find it?

Worst case I’ll help you out via zoom this week, so don’t worry too much :)
 
Got it :)

What happens when you run the restore commands? As if you are running from the home folder that you land in from the Pi, it should be able to find it?

Worst case I’ll help you out via zoom this week, so don’t worry too much :)
Got it :)

What happens when you run the restore commands? As if you are running from the home folder that you land in from the Pi, it should be able to find it?

Worst case I’ll help you out via zoom this week, so don’t worry too much :)

That would be awesome Dave - Appreciate it :)

So when i run the restore command - this is what terminal shows:

pi@raspberrypi:~ $ # Stop the teslamate container to avoid write conflicts
pi@raspberrypi:~ $ docker-compose stop teslamate
create schema public;
create extension cube;
create extension earthdistance;
CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
RETURNS public.earth
LANGUAGE SQL
IMMUTABLE STRICT
PARALLEL SAFE
AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$1)))::public.earth';
.

# Restore
docker-compose exec -T database psql -U teslamate -d teslamate < teslamate.bck

# Restart the teslamate container
Stopping pi_teslamate_1 ... done
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Drop existing data and reinitialize
pi@raspberrypi:~ $ docker-compose exec -T database psql -U teslamate << .
> drop schema public cascade;
> create schema public;
> create extension cube;
> create extension earthdistance;
> CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
> RETURNS public.earth
> LANGUAGE SQL
> IMMUTABLE STRICT
> PARALLEL SAFE
> AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$1)))::public.earth';
> .
NOTICE: drop cascades to 23 other objects
DETAIL: drop cascades to extension cube
drop cascades to extension earthdistance
drop cascades to table schema_migrations
drop cascades to table cars
drop cascades to table drives
drop cascades to table positions
drop cascades to type states_status
drop cascades to table states
drop cascades to table charging_processes
drop cascades to table charges
drop cascades to table updates
drop cascades to table addresses
drop cascades to table tokens
drop cascades to table settings
drop cascades to type unit_of_length
drop cascades to type unit_of_temperature
drop cascades to table geofences
drop cascades to function convert_m(double precision,text)
drop cascades to type range
drop cascades to table car_settings
drop cascades to type billing_type
drop cascades to function convert_km(numeric,text)
drop cascades to function convert_celsius(numeric,text)
DROP SCHEMA
CREATE SCHEMA
CREATE EXTENSION
CREATE EXTENSION
CREATE FUNCTION
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Restore
pi@raspberrypi:~ $ docker-compose exec -T database psql -U teslamate -d teslamate < teslamate.bck
-bash: teslamate.bck: No such file or directory
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Restart the teslamate container
pi@raspberrypi:~ $ docker-compose start teslamate
Starting teslamate ... done
pi@raspberrypi:~ $ pi@raspberrypi:~ $ # Stop the teslamate container to avoid write conflicts
# Restart the teslamate container
Stopping pi_teslamate_1 ... done
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Drop existing data and reinitialize
pi@raspberrypi:~ $ docker-compose exec -T database psql -U teslamate << .
> drop schema public cascade;
> create schema public;
> create extension cube;
> create extension earthdistance;
> CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
> RETURNS public.earth
> LANGUAGE SQL
> IMMUTABLE STRICT
> PARALLEL SAFE
> AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$-bash: pi@raspberrypi:~: command not found
1)))::public.earth';
> .
NOTICE: drop cascades to 23 other objects
DETAIL: drop cascades to extension cube
drop cascades to extension earthdistance
drop cascades to table schema_migrations
drop cascades to table cars
drop cascades to table drives
drop cascades to table positions
drop cascades to type states_status
drop cascades to table states
drop cascades to table charging_processes
drop cascades to table charges
drop cascades to table updates
drop cascades to table addresses
drop cascades to table tokens
drop cascades to table settings
drop cascades to type unit_of_length
drop cascades to type unit_of_temperature
drop cascades to table geofences
drop cascades to function convert_m(double precision,text)
drop cascades to type range
drop cascades to table car_settings
drop cascades to type billing_type
drop cascades to function convert_km(numeric,text)
drop cascades to function convert_celsius(numeric,text)
DROP SCHEMA
CREATE SCHEMA
CREATE EXTENSION
CREATE EXTENSION
CREATE FUNCTION
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Restore
pi@raspberrypi:~ $ docker-compose exec -T database psql -U teslamate -d teslamate < teslamate.bck
-bash: teslamate.bck: No such file or directory
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Restart the teslamate container
pi@raspberrypi:~ $ docker-compose start teslamate
Starting teslamate ... done
pi@raspberrypi:~ $ pi@raspberrypi:~ $ docker-compose stop teslamate
-bash: pi@raspberrypi:~: command not found
pi@raspberrypi:~ $ create schema public;
-bash: create: command not found
pi@raspberrypi:~ $ create extension cube;
-bash: create: command not found
pi@raspberrypi:~ $ create extension earthdistance;
-bash: create: command not found
pi@raspberrypi:~ $ CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
-bash: syntax error near unexpected token `('
pi@raspberrypi:~ $ RETURNS public.earth
-bash: RETURNS: command not found
pi@raspberrypi:~ $ LANGUAGE SQL
-bash: LANGUAGE: command not found
pi@raspberrypi:~ $ IMMUTABLE STRICT
-bash: IMMUTABLE: command not found
pi@raspberrypi:~ $ PARALLEL SAFE
-bash: PARALLEL: command not found
pi@raspberrypi:~ $ AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$1)))::public.earth';
-bash: AS: command not found
pi@raspberrypi:~ $ .
-bash: .: filename argument required
.: usage: . filename [arguments]
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Restore
pi@raspberrypi:~ $ docker-compose exec -T database psql -U teslamate -d teslamate < teslamate.bck
-bash: teslamate.bck: No such file or directory
pi@raspberrypi:~ $
pi@raspberrypi:~ $ # Restart the teslamate container
pi@raspberrypi:~ $ Stopping pi_teslamate_1 ... done
-bash: Stopping: command not found
pi@raspberrypi:~ $ pi@raspberrypi:~ $
-bash: pi@raspberrypi:~: command not found
pi@raspberrypi:~ $ pi@raspberrypi:~ $ # Drop existing data and reinitialize
-bash: pi@raspberrypi:~: command not found
pi@raspberrypi:~ $ pi@raspberrypi:~ $ docker-compose exec -T database psql -U teslamate << .
> > drop schema public cascade;
> > create schema public;
> > create extension cube;
> > create extension earthdistance;
> > CREATE OR REPLACE FUNCTION public.ll_to_earth(float8, float8)
> > RETURNS public.earth
> > LANGUAGE SQL
> > IMMUTABLE STRICT
> > PARALLEL SAFE
> > AS 'SELECT public.cube(public.cube(public.cube(public.earth()*cos(radians(\$1))*cos(radians(\$2))),public.earth()*cos(radians(\$1))*sin(radians(\$2))),public.earth()*sin(radians(\$1)))::public.earth';
> > .
> NOTICE: drop cascades to 23 other objects
> DETAIL: drop cascades to extension cube
> drop cascades to extension earthdistance
> drop cascades to table schema_migrations
> drop cascades to table cars
> drop cascades to table drives
> drop cascades to table positions
> drop cascades to type states_status
> drop cascades to table states
> drop cascades to table charging_processes
> drop cascades to table charges
> drop cascades to table updates
> drop cascades to table addresses
> drop cascades to table tokens
> drop cascades to table settings
> drop cascades to type unit_of_length
> drop cascades to type unit_of_temperature
> drop cascades to table geofences
> drop cascades to function convert_m(double precision,text)
> drop cascades to type range
> drop cascades to table car_settings
> drop cascades to type billing_type
> drop cascades to function convert_km(numeric,text)
> drop cascades to function convert_celsius(numeric,text)
> DROP SCHEMA
> CREATE SCHEMA
> CREATE EXTENSION
> CREATE EXTENSION
> CREATE FUNCTION
> pi@raspberrypi:~ $
> pi@raspberrypi:~ $ # Restore
> pi@raspberrypi:~ $ docker-compose exec -T database psql -U teslamate -d teslamate < teslamate.bck
> -bash: teslamate.bck: No such file or directory
> pi@raspberrypi:~ $
> pi@raspberrypi:~ $ # Restart the teslamate container
> pi@raspberrypi:~ $ docker-compose start teslamate
> Starting teslamate ... done

When i then start Teslamate - Everything is wiped and i have to log in and set up everything again like if it factory restored everything :(
Its probably something simple im missing but i cant figure out what!
 
Hi all,

I've tried for a few days, including a fresh installation etc. but for whatever reason I was not able to pull much data from my car to Teslamate.
On the off chance I've tried Tezlab ( iOS app ), and it seems to work perfectly well ( although at a cost of £6 pm ).

Granted, most likely missing a lot of what Teslamate has to offer, but the hassle in the end just wasn't worth it ( although it is most likely my lack of IT skills :) ).

In case anyone else is in the same boat - I am still able to collate my charging costs / locations, driving data, battery usage, efficiency, control the car etc.
 
Couple of things @w3zly

Firstly, don’t copy the # hashed out headers / notes.

Secondly, when you are at the command prompt, if you run: ls

do you see the .bck file?

Bit worried from the file size in your directory that the backup might not be working as it seems to be 541 bytes?

Are you copying it back from a cloud instance or
somewhere else?
 
Couple of things @w3zly

Firstly, don’t copy the # hashed out headers / notes.

Secondly, when you are at the command prompt, if you run: ls

do you see the .bck file?

Bit worried from the file size in your directory that the backup might not be working as it seems to be 541 bytes?

Are you copying it back from a cloud instance or
somewhere else?

So when i run ls i see the below:
upload_2021-1-3_20-20-22.png


Ive been running Teslamate since the beginning of December so maybe thats why its showing a smaller file size? Although, when i look on Google Drive, all the file sizes are the same? Could be an issue?

upload_2021-1-3_20-21-36.png
 
So when i run ls i see the below:
View attachment 623861

Ive been running Teslamate since the beginning of December so maybe thats why its showing a smaller file size? Although, when i look on Google Drive, all the file sizes are the same? Could be an issue?

View attachment 623862

I don’t think the backup is working tbh, you’d expect the file size to creep up a tiny bit, even if it was just to capture the sleep / awake data.

The file you are trying to restore (likely empty) is also not in that directory.

I’d suggest running a manual backup (following the instructions from the teslamate site) to make sure you have one where ever you are running the other instance and copying that over to your pi
 
I don’t think the backup is working tbh, you’d expect the file size to creep up a tiny bit, even if it was just to capture the sleep / awake data.

The file you are trying to restore (likely empty) is also not in that directory.

I’d suggest running a manual backup (following the instructions from the teslamate site) to make sure you have one where ever you are running the other instance and copying that over to your pi
Damn...looks like ill have to start from scratch again

Ok - So here's my next question if i may....

  • I used the Teslamate site to install TM using Docker (same as your guide)
  • Once TM is setup, if i then follow the backup guide i run into my next issue:
  • Using the guide on the TM site, I Putty into my Pi
  • Then use the command to create a backup: docker-compose exec -T database pg_dump -U teslamate teslamate > /backuplocation/teslamate.bck
  • I then get the error: -bash: /backuplocation/teslamate.bck: No such file or directory
  • If i use the md command to create a folder i get this error: -bash: -bash:: command not found
No idea what im doing wrong here?
 
Damn...looks like ill have to start from scratch again

Ok - So here's my next question if i may....

  • I used the Teslamate site to install TM using Docker (same as your guide)
  • Once TM is setup, if i then follow the backup guide i run into my next issue:
  • Using the guide on the TM site, I Putty into my Pi
  • Then use the command to create a backup: docker-compose exec -T database pg_dump -U teslamate teslamate > /backuplocation/teslamate.bck
  • I then get the error: -bash: /backuplocation/teslamate.bck: No such file or directory
  • If i use the md command to create a folder i get this error: -bash: -bash:: command not found
No idea what im doing wrong here?

Let’s try and do a remote session this week (hopefully tomorrow) and try and figure this out.

I’ll PM you when you I’ve gone through my calendar tomorrow