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.
Can't work out how to edit posts if that's a thing on this forum but you can also find it in the grafana and teslamate variables: DATABASE_HOST, DATABASE_USER and DATABASE_PASS are the values you need to substitute into the connection string

By default these are database, teslamate and secret
 
And finally (sorry, used to places with edit buttons!) I just realised I missed the DATABASE_NAME which will also need substituting in the 'Database=' bit in the connection string, which is by default 'teslamate'

I'll continue replying on the GitHub issue so we're not duplicating stuff all over the place, here's the link for others running into the same issues: Unable to Connect to Database Error · Issue #8 · MattJeanes/TeslaMateAgile
 
I can't even figure out how to get this thing off of Github and into a Docker container. Wish there was an idiots guide to this stuff, because even though I've been in IT for a long time I don't get this stuff at all :(

Same, but I am a mere mortal product manager :) I intend to document the process and contribute it to the project once I get it working!
 
  • Like
Reactions: Durzel
Did you have a look at my guide @Durzel ? I'm in IT too, but Linux is definitely not my strong point.
Sorry I should've been clearer, I meant this TeslaMateAgile, not TeslaMate. I managed to get TeslaMate up and running by following the very helpful step by step guide on his website, but the TeslaMateAgile README assumes a level of knowledge of Docker that I don't have - it literally just says "You can either use it in a Docker container".

I understand the concept of containerisation and am running VMs at work under Hyper-V, just don't really know how ot get TeslaMateAgile off Github and "into" Docker, so to speak.
 
  • Like
Reactions: DaveW and drewpost
Sorry I should've been clearer, I meant this TeslaMateAgile, not TeslaMate. I managed to get TeslaMate up and running by following the very helpful step by step guide on his website, but the TeslaMateAgile README assumes a level of knowledge of Docker that I don't have - it literally just says "You can either use it in a Docker container".

I understand the concept of containerisation and am running VMs at work under Hyper-V, just don't really know how ot get TeslaMateAgile off Github and "into" Docker, so to speak.

install Docker on the machine you are running TeslaMate on and then, in the Terminal, run this command

docker pull mattjeanes/teslamateagile

That will pull it. You need to then pass through the correct environment variables and then run the container, passing through those variables.
 
  • Like
Reactions: Durzel
OK so the key to getting it working for me was to add the service to the original docker compose file, stop the service and then docker-compose up and it started everything and everything talked just fine.

I'm not sure if it works historically though or only if it's point in time forward.

From what Matt posted on Facebook, it will fill in any empty prices, so I think if you’ve got costs for the previous charges it won’t do anything to them.

That right @MattJeanes ?
 
From what Matt posted on Facebook, it will fill in any empty prices, so I think if you’ve got costs for the previous charges it won’t do anything to them.

That right @MattJeanes ?

Yes, however the catch here is that they must be empty fields. Matt let me know that on the GitHub issue.

I had Go so the value was set at 0.05 an I hadn't bothered disabling that when I switched to Agile so I"m going back and deleting the values per charge, then it updates them accordingly when it runs next.
 
  • Like
Reactions: DaveW
@Durzel and @Mr Miserable I have now updated the app and documentation to make set up much easier assuming you have used the Docker install from the TeslaMate documentation (Docker install | TeslaMate)

Please have a look and hopefully you can get it all working. If you're running into issues please raise a GitHub issue or email me (you can find my email on my GitHub profile) as I don't check here very often :)
 
  • Like
Reactions: tj333 and Durzel
I think Matt has updated the instructions following the above now - might be worth checking again :)

I don't have agile (yet) or I'd write something up myself.
He has. And with those new instructions it works like a charm (no doubt it would've worked anyway but rolling it into the existing TeslaMate docker-compose.yml worked nicely).

One small caveat to his instructions, the TeslaMate Docker install guide parameterises the database connection settings, whereas on @MattJeanes Github repo he has hardcoded them as "teslamate" and "secret" etc. If you've followed the TeslaMate Docker instructions to the letter and set up the username & password in the .env file, then it won't work if you have changed the password to something other than "secret".

Simple fix is:
Code:
...
teslamateagile:
    image: mattjeanes/teslamateagile:latest
    restart: always
    environment:
      - DATABASE_USER=${TM_DB_USER}
      - DATABASE_PASS=${TM_DB_PASS}
      - DATABASE_NAME=${TM_DB_NAME}
      - DATABASE_HOST=database
...

It pulled my Agile prices across and I've cross referenced it with one of my PDF bills and it's within a couple of pennies tolerance as far as I can see.
 
  • Like
Reactions: DaveW
Yes, I was following the default simple setup which also has them hardcoded, I see that the advanced installs use variables but I will leave the default instructions there as if you're following the advanced install you can probably work out that they should be substituted for the variables.

The energy calculation is the hard bit as the car only reports how much has been added to the battery whereas the amount of energy used is higher due to losses in AC/DC conversion - I pulled an algorithm from TeslaMate itself to calculate this value, and from what I've seen so far it all adds up to the same total that TeslaMate generates (energy used in charges). It will probably be very slightly off as it might miss the very start or end of a charge by a few seconds but we're talking like a couple of pennies maximum (depending on your energy cost!)

I'd like to see how it handles the plunge pricing when it goes negative, it should in theory work but I've been unable to test it as of yet!
 
  • Like
Reactions: Durzel and Roy W.
I have a charging entry that is negative, but I can’t remember whether I hardcoded that into the database (TeslaMate doesn’t let you enter negative costs in the UI)

Thanks for updating the README. I missed your post earlier saying you’d done it somehow!
 
  • Like
Reactions: MattJeanes