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.
You can run TeslaMate on a free Google Cloud Platform instance. Instructions (for the GSP part) here.

I have been running it on that for a while now without any issues. I did upgrade my instance to a "small" though, which isn't free, mainly because I've got $300 of credit to burn up.

Thanks @Durzel have you set it up with a domain, or just used whatever the server name might be? https as per the advanced guide, or did you just follow the normal instructions but put a password on front of the server?
 
How easy is it to add a charge manually?

There is some talk of it here:
How to manually add charging sessions to complete the history of the monitored car? · Issue #792 · adriankumpf/teslamate

But the one guy didn't come back with the SQL statement he used to manually add a charge. I have all the details of my single missing charge from the day I collected the M3, but I fear figuring out how to add it is slightly beyond me.

What outcome are you trying to achieve? Are you just trying to get the fact that it was charged, a cost logged and an approximate number of kWh added?

I've not looked into it as closely as @Durzel has above, it should be possible but might be fiddly. Left-field idea might even be using some SQL to clone an existing charge session and then tweak some numbers afterwards.
 
You can run TeslaMate on a free Google Cloud Platform instance. Instructions (for the GSP part) here.

I have been running it on that for a while now without any issues. I did upgrade my instance to a "small" though, which isn't free, mainly because I've got $300 of credit to burn up.
Would you be so kind enough to do a quick "How to" please :)

I did the setup as your link and have the free F1-micro (inc my $300 credit)
Got all the addons and the docker-compose.yml sorted, but it stops there, i get an error trying to run it
 
Hi,

I followed this guide - Advanced install with Traefik, Let's Encrypt & HTTP Basic Auth | TeslaMate

I have my own domain, so I created two subdomains (teslamate.mydomain.com and grafana.mydomain.com) to use.

Once you've followed that guide you simply start the whole thing with docker-compose up. This will print all of the debugging output to the screen, in case you have a problem. Once you are sure it is working, close it down (hit CTRL+C and let it shut down) then do docker-compose up -d

I wouldn't say I'm an expert in it to be honest, it's the first time I've used Docker and Google Cloud Platform in anger.
 
  • Like
Reactions: davidmc
What outcome are you trying to achieve? Are you just trying to get the fact that it was charged, a cost logged and an approximate number of kWh added?

I've not looked into it as closely as @Durzel has above, it should be possible but might be fiddly. Left-field idea might even be using some SQL to clone an existing charge session and then tweak some numbers afterwards.
I only looked at it today, as a curiosity.

It is fiddly because there is a record in the charges table for every ~20 seconds of the charge, recording various metrics. You could replicate a batch of these from another charge, but I don't know if the information is used elsewhere or not. If other parts of the system rely on just the charging_processes table then it might be ok. Probably a question for the author of TeslaMate really.
 
I only looked at it today, as a curiosity.

It is fiddly because there is a record in the charges table for every ~20 seconds of the charge, recording various metrics. You could replicate a batch of these from another charge, but I don't know if the information is used elsewhere or not. If other parts of the system rely on just the charging_processes table then it might be ok. Probably a question for the author of TeslaMate really.

If time allows I'll try and look into it in more detail.
 
  • Like
Reactions: Durzel
Hi,
I followed this guide - Advanced install with Traefik, Let's Encrypt & HTTP Basic Auth | TeslaMate
I have my own domain, so I created two subdomains (teslamate.mydomain.com and grafana.mydomain.com) to use.

I tried to do the same... and it almost works! :)

There is an error relative to the ACME certificate during the docker-compose up:
Code:
proxy_1      | time="2020-06-30T19:57:40Z" level=error msg="Unable to obtain ACME certificate for domains \"teslamate.mydomain.com\": cannot get ACME client get directory at 'https://acme-v02.api.letsencrypt.org/directory': Get \"https://acme-v02.api.letsencrypt.org/directory\": dial tcp: lookup acme-v02.api.letsencrypt.org on 127.0.0.11:53: read udp 127.0.0.1:39471->127.0.0.11:53: read: connection refused" routerName=teslamate@docker rule="Host(`teslamate.mydomain.com`)" providerName=tmhttpchallenge.acme
proxy_1      | time="2020-06-30T19:57:40Z" level=error msg="Unable to obtain ACME certificate for domains \"grafana.mydomain.com\": cannot get ACME client get directory at 'https://acme-v02.api.letsencrypt.org/directory': Get \"https://acme-v02.api.letsencrypt.org/directory\": dial tcp: lookup acme-v02.api.letsencrypt.org on 127.0.0.11:53: read udp 127.0.0.1:34088->127.0.0.11:53: read: connection refused" routerName=grafana@docker rule="Host(`grafana.mydomain.com`)" providerName=tmhttpchallenge.acme

The Teslamate page works and I see the car's data but in Grafana there is an issue with the database connection:
Code:
dial tcp: lookup database on 127.0.0.11:53: read udp 127.0.0.1:38293->127.0.0.11:53: read: connection refused

Does anyone have an idea where to look?

Thanks
 
What outcome are you trying to achieve? Are you just trying to get the fact that it was charged, a cost logged and an approximate number of kWh added?

I've not looked into it as closely as @Durzel has above, it should be possible but might be fiddly. Left-field idea might even be using some SQL to clone an existing charge session and then tweak some numbers afterwards.

I’d say the reason is three fold:

1) Total cost
2) Total number of charges and kwh added
3) OCD!

In an ideal world I’d also be able to log the 75 miles I didn’t log on Day 1 ownership. I presume the data produced by the API is transient (hence the need for real-time loggers)? ie. once it is gone it is gone and there is no way of interrogating historical data from it?
 
Managed to get it working today on the free instance of GCP today (@davidmc), here's the steps I took to make it work.

Now looking to import my data and also amend the htaccess/htpasswd setup to whitelist my home IP to stop me having to enter my password.

 
Managed to get it working today on the free instance of GCP today (@davidmc), here's the steps I took to make it work.

Now looking to import my data and also amend the htaccess/htpasswd setup to whitelist my home IP to stop me having to enter my password.

How do you create these two subdomains? The rest i can (Kind of!) follow and thanks both @DaveW & @Durzel

Create two subdomains for your domain (teslamate + grafana) and point the A NAME records to your public IP of the Micro VM
 
Hmm, only issue I've got is it's not serving a lets encrypt cert, only a Traefik self signed one - do you get the same issue @Durzel ? (clicking on the padlock if you've already accepted it should show if self signed of letsencrypt)

How do you create these two subdomains? The rest i can (Kind of!) follow and thanks both @DaveW & @Durzel

Create two subdomains for your domain (teslamate + grafana) and point the A NAME records to your public IP of the Micro VM

You'll need to do that wherever you manage your domain's DNS, so wherever you purchased your domain from should have some kind of portal to let you edit those.
 
  • Like
Reactions: Durzel and davidmc
I'm not sure the certbot part is needed for the Traefik install - I'm deleting all that now, so maybe hold off for now until I can get the lets encrypt working properly, otherwise you get a security error when trying to access which is fairly annoying
 
  • Like
Reactions: davidmc
Hmm, only issue I've got is it's not serving a lets encrypt cert, only a Traefik self signed one - do you get the same issue @Durzel ? (clicking on the padlock if you've already accepted it should show if self signed of letsencrypt)



You'll need to do that wherever you manage your domain's DNS, so wherever you purchased your domain from should have some kind of portal to let you edit those.
Nope, mine is using Lets Encrypt, not self-signed.

I'm pretty sure I did the actual initial docker-compose up part of it as root though. I have an "acme" directory (for the Lets Encrypt stuff) in the root of my TeslaMate VM, which has root permissions, so that would've been created by that initial setup.

When I upgrade it or shut it down it's done via sudo docker-compose down etc, so I'm running the main commands as root.
 
Nope, mine is using Lets Encrypt, not self-signed.

I'm pretty sure I did the actual initial docker-compose up part of it as root though. I have an "acme" directory (for the Lets Encrypt stuff) in the root of my TeslaMate VM, which has root permissions, so that would've been created by that initial setup.

When I upgrade it or shut it down it's done via sudo docker-compose down etc, so I'm running the main commands as root.

Did you create the acme directory, or was that done as part of the docker process? I'll run it as sudo too this time.

As there's no data, I'm just junking the boxes and trying again until I get it right :)
 
Did you create the acme directory, or was that done as part of the docker process? I'll run it as sudo too this time.

As there's no data, I'm just junking the boxes and trying again until I get it right :)
No, I didn't create the acme directory or the file within in, I presume the initial compose did. I knew what "acme" was because I use Let's Encrypt on production servers at work.

This is what my home folder looks like:

Screenshot-2020-07-01-at-13.09.54.png


Ordinarily I wouldn't run things as root unnecessarily, but a little GCP instance out there in the world is not going to compromise anything else I do elsewhere, and I take daily automated backups of the data.

EDIT: If you want to just bin it entirely and start again you should be able to do docker-compose rm -s
 
Last edited:
As there's no data, I'm just junking the boxes and trying again until I get it right :)
I've been playing around with this since yesterday too and also been trying allsorts of combinations to get it to work. The closest I've managed is by using an Ubuntu image instead of the Debian one, but the problem there is it runs out of resources on the micro engine and kills Docker when I try to run the final compose command, so I had to upgrade to the small engine in order to get it up and running, which obviously won't be free once I eventually run out of my $300 credit. On Debian I've been running into the same issues with the traefik certificates not working.
 
No, I didn't create the acme directory or the file within in, I presume the initial compose did. I knew what "acme" was because I use Let's Encrypt on production servers at work.

This is what my home folder looks like:

View attachment 559011

Ordinarily I wouldn't run things as root unnecessarily, but a little GCP instance out there in the world is not going to compromise anything else I do elsewhere, and I take daily automated backups of the data.

EDIT: If you want to just bin it entirely and start again you should be able to do docker-compose rm -s

Well I now have the acme directory with the same file structures as you, but it still only uses the self signed traefik cert!

Screenshot 2020-07-01 at 13.25.00.png


There's something not right about the setup of it, the apache instructions didn't seem to work yesterday, but that might be down to the way the GCP instance spins up apache.

I've been playing around with this since yesterday too and also been trying allsorts of combinations to get it to work. The closest I've managed is by using an Ubuntu image instead of the Debian one, but the problem there is it runs out of resources on the micro engine and kills Docker when I try to run the final compose command, so I had to upgrade to the small engine in order to get it up and running, which obviously won't be free once I eventually run out of my $300 credit. On Debian I've been running into the same issues with the traefik certificates not working.

Incredibly annoying isn't it! - I'm sure we'll figure it out on here between us, can then write up the instructions for anyone else struggling with it.
 
Well I thought I was getting somewhere - followed your steps a little further up but leaving out the certbot step and things initially appeared to be working - I was able to access both the teslamate and grafana pages with a secure connection, however when I tried to look at the grafana data I got the same issue as p-f-g above with it telling me:
Templating init failed
dial tcp: lookup database on 127.0.0.11:53: read udp 127.0.0.1:43007->127.0.0.11:53: read: connection refused
 
Well I thought I was getting somewhere - followed your steps a little further up but leaving out the certbot step and things initially appeared to be working - I was able to access both the teslamate and grafana pages with a secure connection, however when I tried to look at the grafana data I got the same issue as p-f-g above with it telling me:

Bit baffled how the instructions you followed, that I wrote / used don't get the secure cert working! - What directory did you run it from?