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.
Hi All,

I'm hoping that some can help me diagnose why my backups aren't syncing to google drive.

I had this working back in 2021 before I stopped using teslamate for a long while. I've restored an old backup and have teslamate all up and running again, hooray.

I've used these instruction: How to perform an automated TeslaMate backup to Google Drive - TeslaEV.co.uk which I'm sure many of you are familiar with.

I've set up rclone and I am able to access, mkdir etc. in my google drive - I see the 'TeslaMate' folder there no problem. Weirdly, the first time I tested this, a backup file copied across OK but I simply haven't been able to do it again!

when I run `./tmbackup.sh`, I don't seem to ever get access to the terminal back. I've waited 2.5 hours at the longest.

If I do use ctrl + C to end the script, I can see using `ls-a` that a large backup file has been created, it just doesn't seem to get copied by rclone.

I've tried to editing and removing/adding the rclone remote. Still no luck though. Is there a way to get logs?

edit: this is my tmbacup.sh:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin now=`date +"%A"` cd /home/lex/tmbackup sudo /usr/local/bin/docker-compose exec -T database pg_dump -U teslamate teslamate > /home/lex/tmbackup/teslamate.bck_$>rclone copy --max-age 24h /home/lex/tmbackup --include 'teslamate.*' gdrive:TeslaMate
Try running the lines one at a time to see what part is failing at. i.e. is it the dump or the transfer.
 
Hmm... did TeslaMate remove the functionality where you could see where/which road you hit what speed/car was at what temperature etc? I used to be able to mouse over the drive stats, and it would show me a blue dot on the map where X happened. This seems to be gone now. :(
They won't have removed it, but sometimes when changes are made to Grafana, functionality is lost. This particular functionality was lost before. Raise it as an issue on the GitHub page.

Edit: There's already one raised.
 
How long ago did it work? I seem to remember there was some security change made to gdrive that impacted this script. Can't recall if it was fixed or ended up not being an issue.

set and forget - mid 2021, but just two or three days ago I set it up and the first test worked.

Here's the baffling part - I gave up, walked away and this morning I checked my drive and the cron job was successful at 3:01am (it only took 1 minute)

You can also add

and

to the rclone command to get debug level logging to a text file called my log.txt

I will do that if it starts been unreliable. I suspect it had something to with using a TeslaMate folder what was made by rclone a long time ago.
It could also be related to the permission level I chose in rclone (4). I changed it to (1) yesterday, but testing still didn't work. I would rather not give complete access to my entire drive though so may revisit it in a few days.
 
  • Like
Reactions: init6
Hey all
I spent hours last night trying everything possible and fail so I am reaching out for some help.
When I first installed tesla mate I put in a space between password: and the actual password in the docker compose file.
I believe this causes problems to connecting the the database (tesla mate installs fine, I loaded my car, but nothing in grafana and there is an error. Googled the error and someone else did the same thing and had the same issue).
My problem is deleting the postgres so that I can start over. I've googled and tried every command I can find.

Anyone can walk me through how to remove the teslamate postgres so that I can start over?

Thanks
 
Hey all
I spent hours last night trying everything possible and fail so I am reaching out for some help.
When I first installed tesla mate I put in a space between password: and the actual password in the docker compose file.
I believe this causes problems to connecting the the database (tesla mate installs fine, I loaded my car, but nothing in grafana and there is an error. Googled the error and someone else did the same thing and had the same issue).
My problem is deleting the postgres so that I can start over. I've googled and tried every command I can find.

Anyone can walk me through how to remove the teslamate postgres so that I can start over?

Thanks
Which password did you put the space into? Sounds like grafana is not able to login to the database, but you haven't shared the error message so we're just guessing.
Do you want to delete just the database - or start the whole teslamate install from scratch?
 
From this very thread:

 
Which password did you put the space into? Sounds like grafana is not able to login to the database, but you haven't shared the error message so we're just guessing.
Do you want to delete just the database - or start the whole teslamate install from scratch?

From this very thread:


Thanks for the reply. The problem is that removing containers and images does not remove the database. Even though I have removed and reinstalled them about 20 times now, the original database, login/password still exist. Removing the containers and images doesn't wipe the car data either, after reinstalling my car is still there, I don't need to reinput my keys.

This is the error in grafana:
Code:
Object
status:500
statusText:"Internal Server Error"
data:Object
message:"Query data error"
traceID:"00000000000000000000000000000000"
config:Object
url:"api/ds/query"
method:"POST"
data:Object
requestId:"Q100"
retry:0
headers:Object
hideFromInspector:false
message:"Query data error"

Which is exactly the same situation this guy had: Grafana "query data error" after following docker installation guide · Discussion #2773 · adriankumpf/teslamate
However, changing the password like he suggested does not work for me, I get this error:
Code:
postgres@Oasis:~$ psql -U teslamate -d teslamate
psql: FATAL:  Peer authentication failed for user "teslamate"

So that is why I am just trying to start from scratch and remove the database completely.
 
Thanks for the reply. The problem is that removing containers and images does not remove the database. Even though I have removed and reinstalled them about 20 times now, the original database, login/password still exist. Removing the containers and images doesn't wipe the car data either, after reinstalling my car is still there, I don't need to reinput my keys.

This is the error in grafana:
Code:
Object
status:500
statusText:"Internal Server Error"
data:Object
message:"Query data error"
traceID:"00000000000000000000000000000000"
config:Object
url:"api/ds/query"
method:"POST"
data:Object
requestId:"Q100"
retry:0
headers:Object
hideFromInspector:false
message:"Query data error"

Which is exactly the same situation this guy had: Grafana "query data error" after following docker installation guide · Discussion #2773 · adriankumpf/teslamate
However, changing the password like he suggested does not work for me, I get this error:
Code:
postgres@Oasis:~$ psql -U teslamate -d teslamate
psql: FATAL:  Peer authentication failed for user "teslamate"

So that is why I am just trying to start from scratch and remove the database completely.

Ok FINALLY good news. I was changing the password in the wrong terminal. Inside of synology > docker. In the container section I selected docker_database_1 and hit "details". From there I went to terminal, create with command, and put in psql -U teslamate -d teslamate
There I was able to create the new password (same as new password in the yml file) and it resolved the issues.
Finally I am up and running woohoooooooo
 
Does anyone know why Teslamate is not closing drives? It looks like the data is recorded but split up into thousands of 15 second drives. The teslamate logs look like this:

[36mteslamate |[0m 2022-08-02 08:32:12.313 car_id=1 [info] Driving / Start
[36mteslamate |[0m 2022-08-02 08:32:27.607 car_id=1 [info] Start / :eek:nline
[36mteslamate |[0m 2022-08-02 08:32:27.612 car_id=1 [info] Connecting ...
[36mteslamate |[0m 2022-08-02 08:32:27.614 [info] Start of drive initiated by: %TeslaApi.Vehicle.State.Drive{gps_as_of: 1659450746, heading: 360, latitude: 53, longitude: -113, native_latitude: 53, native_location_supported: 1, native_longitude: -113, native_type: "wgs", power: 13, shift_state: "D", speed: 40, timestamp: 1659450747539}
[36mteslamate |[0m 2022-08-02 08:32:27.614 car_id=1 [info] Driving / Start
[36mteslamate |[0m 2022-08-02 08:32:42.874 car_id=1 [info] Start / :eek:nline
[36mteslamate |[0m 2022-08-02 08:32:42.895 car_id=1 [info] Connecting ...
[36mteslamate |[0m 2022-08-02 08:32:42.896 [info] Start of drive initiated by: %TeslaApi.Vehicle.State.Drive{gps_as_of: 1659450761, heading: 360, latitude: 53, longitude: -113, native_latitude: 53, native_location_supported: 1, native_longitude: -113, native_type: "wgs", power: 7, shift_state: "D", speed: 41, timestamp: 1659450762803}
So, the drives show nothing but the trip shows fine. The effect is that efficiency and many other panels that depend on a beginning/ending trip doesn't work. I'm using teslamate 1.28.0 (edge) on Ubuntu 21.02 LTS with all updates. It doesn't matter if I use postgres 12/13/14.

The end of the drive is logged like this:
[36mteslamate |[0m 2022-08-02 17:47:37.315 [info] End of drive initiated by: %TeslaApi.Vehicle.State.Drive{gps_as_of: 1659484055, heading: 271, latitude: 53, longitude: -113, native_latitude: 53, native_location_supported: 1, native_longitude: -113, native_type: "wgs", power: 1, shift_state: "P", speed: 0, timestamp: 1659484056337}
[36mteslamate |[0m 2022-08-02 17:47:37.315 car_id=1 [info] Driving / Ended / 0 km – 0 min
 
Last edited:
Finally got our car and some data into TeslaMate. What a cracker! So much info for an info nerd. Thanks so much for this great app and all the effort everyone here offers to help newbs like me.
Now to work on some fancy grafana pages.
If you produce generally applicable dashboards, I highly suggest you contribute back to TeslaMate through GitHub.
 
Is there a way to remove all data from telsamate from a specific timeframe? I went on a roadtrip last month and when got to the destination I noticed the pc I use for teslamate had rebooted during the trip. I logged back in and then the pc rebooted again before the drive back. Now I have two really ugly lines in my visited page.
Screenshot 2022-08-07 140531.png


I see how to delete a drive or charge but I cannot find any drives or charges in that timeframe. Only thing I can really find is this dot in the charging stats screen but there's no data to go along with it.
Screenshot 2022-08-07 140629.png


I am very much a teslamate/docker newbie (I just really like looking at the drives/graphs) so maybe I am missing something somewhere but I really want to just delete everything from 7/9/22-7/15/22.
 
Is there a way to remove all data from telsamate from a specific timeframe? I went on a roadtrip last month and when got to the destination I noticed the pc I use for teslamate had rebooted during the trip. I logged back in and then the pc rebooted again before the drive back. Now I have two really ugly lines in my visited page.
View attachment 837778

I see how to delete a drive or charge but I cannot find any drives or charges in that timeframe. Only thing I can really find is this dot in the charging stats screen but there's no data to go along with it.
View attachment 837779

I am very much a teslamate/docker newbie (I just really like looking at the drives/graphs) so maybe I am missing something somewhere but I really want to just delete everything from 7/9/22-7/15/22.
Do you want to remove the entire drives? Or just the portions that are out of wack? I was able to drop a handful of positions and documented how here:

You could do the same and replace positions ID with a timeframe. But do a select first to make sure your commands are returning the data you intend to drop.
 
Do you want to remove the entire drives? Or just the portions that are out of wack? I was able to drop a handful of positions and documented how here:

You could do the same and replace positions ID with a timeframe. But do a select first to make sure your commands are returning the data you intend to drop.
I think I want to remove the entire drive but there is no drive or charge id that I can find. I think I have found the timestamps (1657339200000 and 1657943999000). I took a pretty long look at your link but the extent of my knowledge is creatiing a backup and updating teslamate. I think I'm slightly confused where I need to put the select id command. I did a backup, picked a random drive to try, went to the location of my docker-compose, and input this with this error.
PS C:\Tesla> select id, date, latitude, longitude from positions where drive_id = '2863' order by id asc; Select-Object : A positional parameter cannot be found that accepts argument 'from'. At line:1 char:1 + select id, date, latitude, longitude from positions where drive_id = ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Select-Object], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand
I enjoy learning this kind of stuff but also understand it might be a little above my paygrade.