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.
Nothing in the trips but timeline has this:

1667555447981.png

There is a row that is updating.
 
That's a software update for your car. What time was the missing drive? Anything in the logs around that time?
Looks like Error/ unknown:

teslamate_1 | 2022-11-03 08:27:07.205 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/929641950370872/vehicle_data -> 408 (9093.676 ms)
teslamate_1 | 2022-11-03 08:27:07.205 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil}
teslamate_1 | 2022-11-03 08:27:07.206 car_id=1 [error] Error / :unknown
teslamate_1 | 2022-11-03 08:27:46.384 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/929641950370872/vehicle_data -> 408 (9098.999 ms)
teslamate_1 | 2022-11-03 08:27:46.384 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil}
teslamate_1 | 2022-11-03 08:27:46.384 car_id=1 [error] Error / :unknown
teslamate_1 | 2022-11-03 08:28:25.557 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/929641950370872/vehicle_data -> 408 (9087.027 ms)
teslamate_1 | 2022-11-03 08:28:25.558 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil}
teslamate_1 | 2022-11-03 08:28:25.558 car_id=1 [error] Error / :unknown
teslamate_1 | 2022-11-03 08:29:05.853 car_id=1 [info] Start / :eek:ffline
teslamate_1 | 2022-11-03 09:09:05.768 car_id=1 [info] Start / :asleep
teslamate_1 | 2022-11-03 11:42:38.649 [info] Refreshing access token ...
 
The postcode is stored in the addresses table, so it should be possible. I'll need to do some digging to see how to get that out. How are your DBA skills?

If you only go to a few places then a simpler alternative would be to set up Geofences with the postcode as the name.

Edit: It's actually not that difficult to add the postcode, but you need to be adept at changing dashboard panels.
Cool, I'm new to all this, but love a good tinker! Best way to learn is by trying, failing and then trying again!

(But if you have any tips......;-)
 
PORTAINER + TESLAMATE----> Any guidance in setting up Teslamate through Portainer (within Home Assistant add-on)? I know this isn't the most straightforward approach but I don't see why it won't work. Thanks anyone who can guide me to some steps or instructions.
Portainer is just a front end web GUI to manage docker containers.
Do you need it? I setup my instance and a barely touch it. When I do, command line instructions are more than sufficient.
 
  • Like
Reactions: cwanja
OK - I just got this setup and I can see the cars location so I know it's working, but when I try to view the dashboards it tells me there is no data? Any ideas on how to troubleshoot?
Alright, I got this resolved. It was an errant space in the YAML file (have I mentioned how much I dislike YAML files?). At any rate, we're up and running now. I am a fairly technical person, but I've never used Grafana. I'm excited at the possibilities of what we can do here.

I think I'm going to host this in the cloud so I can access it from anywhere, but is there a way for people to share the code for the awesome dashboards they have built? You all have done some amazing stuff and I'd love to not have to reinvent the wheel.
 
Apologies for the delay. First off you'll need a table in the database with the fuel prices (date and price in pence columns), either a new entire database and data source in PostGres or a new table in the teslamate database. I found using a GUI like PgAdmin the easiest way to do this:
View attachment 857841
The price data for petrol is available from the GOV website in my initial post.

Then change the txt file to a .json file and import to Grafana. Adjust your parameters so it connects to that new DB source.
Change the 29 to your desired MPG in the 'Transform' tab of the table panel:
View attachment 857832

To be clear I'm no expert. This probably isnt the best or most efficient way of displaying this information but I just tried to learn some SQL and Grafana skills :)

There's somethign wrong in the query for generating the "Average Cost Per Mile (EV)" Graph which i'm having a hard problem trying to figure out why. Right now it's showing ~38c/KM when that should be closer to 1-2cents. (I changed the query from mi to km for distance).
1669218734537.png


It appears to be something to do with the "drives" table? Take a look at this table view when i have "FROM charging_processes, drives"

1669218977543.png


and with drives removed:
1669219016687-png.877530



Anyone have an input to this query?
 

Attachments

  • 1669219016687.png
    1669219016687.png
    77.4 KB · Views: 322
There's somethign wrong in the query for generating the "Average Cost Per Mile (EV)" Graph which i'm having a hard problem trying to figure

It appears to be something to do with the "drives" table? Take a look at this table view when i have "FROM charging_processes, drives"



and with drives removed:


Anyone have an input to this query?
I think it's something to do with the joining of the two tables.

Here's the code that I used to get it working. DISCLAIMER: I'm not a DBA.
Code:
SELECT  d.mon as month,

cp.total_cost / convert_km(d.total_distance::NUMERIC, 'mi')*100 as "Pence per Mile"
FROM (
SELECT DATE_TRUNC('month', drives.start_date) as mon, sum(distance) as total_distance
    FROM drives
    GROUP BY DATE_TRUNC('month', drives.start_date)
    ) d
    
FULL JOIN (
    SELECT DATE_TRUNC('month', charging_processes.start_date) as mon, sum(cost) as total_cost
    FROM charging_processes
    GROUP BY DATE_TRUNC('month', charging_processes.start_date)
    ) cp using (mon)

order by mon
 
  • Like
Reactions: Python
Hoping someone can guide me to a fix for this:



For some reason my teslamate page is taking forever to load and only giving me a text only version of the page.

It's running on a pi3. backups are still being generated OK and from what I can tell the MQTT is also being published fine (as I'm still getting the car entities updated in Home Assistant).

Tried the obvious reboots of the pi. Card sapce and memory seem OK. Any hints, or ways to troubleshoot?
 
Last edited by a moderator:
Hoping someone can guide me to a fix for this:

View attachment 881456

For some reason my teslamate page is taking forever to load and only giving me a text only version of the page.

It's running on a pi3. backups are still being generated OK and from what I can tell the MQTT is also being published fine (as I'm still getting the car entities updated in Home Assistant).

Tried the obvious reboots of the pi. Card sapce and memory seem OK. Any hints, or ways to troubleshoot?
What do the logs say?
Top?

And you probably want to remove your location co-ords from the image.
 
What do the logs say?
Top?

And you probably want to remove your location co-ords from the image.
Not sure on best way to do this. I ran
Code:
docker-compose logs teslamate
and got well, a lot of content while loading the page, including trips that show details like my vehicle and to/from locations.

Toward the end there were some tesla API errors, so I might try doing my log-in again if I can get to that page.

Code:
top
top shows cpu usage at about 14%. Anything in particular in there I should be looking for?

Thanks for the heads up, I didn't noticed my location. I can't edit my post but have reported in the hope that an admin will delete the image from it.
 
Not sure on best way to do this. I ran
Code:
docker-compose logs teslamate
and got well, a lot of content while loading the page, including trips that show details like my vehicle and to/from locations.

Toward the end there were some tesla API errors, so I might try doing my log-in again if I can get to that page.

Code:
top
top shows cpu usage at about 14%. Anything in particular in there I should be looking for?

Thanks for the heads up, I didn't noticed my location. I can't edit my post but have reported in the hope that an admin will delete the image from it.
If you can share the output of top and also the API errors (without any location data) we might be able to spot something.