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 guys, I updated to the new version today on my pi, and reallized that my Grafana was set to the default password, and fixed that. Glad to close it up. But, now that it is updated I can no longer get the the status screen that I normally can via http://192.168.1.9:4000/, where I can go to settings and confirm the version number running. Does this update change that somehow?
Let me guess - running TeslaMate on a Raspberry Pi on Debian Buster?
If so, you need to either backport libseccomp2 from backports (Instructions) or upgrade from Buster to Bullseye (How To Upgrade Raspberry Pi OS to Bullseye from Buster)

The former is the easy and safer way to go. The latter - you're almost better off backing up, reinstalling and restoring from backup depending on how much customization you've done to your Pi.
 
  • Like
Reactions: EVCarGUy and doats1
Im updating my pi to Blueberry, clean install. I understand that Grafana wants me to change the password from the default. Im assuming this password needs to match the password in my docker-compose.yml for Grafana?

I'm assuming I have to change the password prior to importing data fro TeslaFi. Is that correct?
 
I understand that Grafana wants me to change the password from the default. Im assuming this password needs to match the password in my docker-compose.yml for Grafana?
No, ideally, they would be different, and both would be randomly generated.

The passwords in your docker-compose.yml file are database user passwords used by the applications to get access to the PostgreSQL database. The database is only accessible to the other services defined by the docker-compose.yml file.

The Grafana password is your end-user "admin" password - this is the password used to authenticate you as a valid user to the Grafana web interface.

I'm assuming I have to change the password prior to importing data fro TeslaFi. Is that correct?
No, you should not.
 
What happens to the data that is collected while the car is not connected to my network for extended periods of time? In my case the car will be gone from home for about 3 weeks. Once the car is back on my network should I expect the data for the last three weeks to be present or will there be data loss?
 
What happens to the data that is collected while the car is not connected to my network for extended periods of time? In my case the car will be gone from home for about 3 weeks. Once the car is back on my network should I expect the data for the last three weeks to be present or will there be data loss?
Your car transmits data via 4g to the Tesla servers, teslamate reads the data stream free n real time (no access to historic data) from the Tesla servers - teslamate never connects directly to the car
 
I prefer visual representations - even though I'm not very good at drawing :)

Screenshot 2022-01-27 at 10.27.14.png

All this data flow happens in real time, except for the grafana bit. As long as your car can connect to Tesla servers then the data is streamed by those servers and any apps that have your credentials can access that stream. As long as your Pi is connected to the internet (and has working credentials) It can connect to that stream and save the data in the database. Grafana is just a front end to access and display the data Teslamate has saved in the database.
If Teslamate is not running then you'll miss some data. Similarly, although much rarer, if the Tesla servers are down or the car has no 4G connection, there will be nothing for Teslamate to save.
 
TeslaMate will do a good job about handling streaming data connection issues. There is a trip I make about two times a year and typically lose cell service in the same spot. TeslaMate picks up the rest of the trip after that and I have to go back and manually terminate the drive (see docs). It also cleans up the rest of the data as well.
 
  • Helpful
  • Like
Reactions: init6 and pkeller
Probably a stupid question, but help is appreciated: I've installed Teslamate (debian guide) so no docker based installation. Everything works, data is being logged, grafana works and so on.

My question now is about MQTT. I see on the teslamate docs page that you should be able to access data like "teslamate/cars/$car_id/display_name" but I can't seem to find where (or get this working)

Can anybody give some guidance here?
 
Probably a stupid question, but help is appreciated: I've installed Teslamate (debian guide) so no docker based installation. Everything works, data is being logged, grafana works and so on.

My question now is about MQTT. I see on the teslamate docs page that you should be able to access data like "teslamate/cars/$car_id/display_name" but I can't seem to find where (or get this working)

Can anybody give some guidance here?
so you need an MQTT broker in your network somewhere, or on the hardware that's running teslamate.
I have an internet of things (IoT) server running all kinds of stuff in the house (and around the farm), it's running Node Red and Mosquitto (the MQTT broker)

Then (in my case since I'm using docker) I edited docker-compose.yml file and set the broker IP address to the Mosquitto.
Teslamate now sends messages to the broker as and when it gets them from tesla's servers.

Then you can use node red or build a webpage (or whatever you'd like) to 'subscribe' to : teslamate/cars/1/+ (in my case)
This allows you to see the data coming in and then action outcomes in node red according to whatever you want etc.
Or in my case I made a web page to see the state of the car, is it locked, the mileage, it's GPS location etc etc
Hope that makes sense...
 
  • Informative
Reactions: Dave EV and cwanja
so you need an MQTT broker in your network somewhere, or on the hardware that's running teslamate.
I have an internet of things (IoT) server running all kinds of stuff in the house (and around the farm), it's running Node Red and Mosquitto (the MQTT broker)

Then (in my case since I'm using docker) I edited docker-compose.yml file and set the broker IP address to the Mosquitto.
Teslamate now sends messages to the broker as and when it gets them from tesla's servers.

Then you can use node red or build a webpage (or whatever you'd like) to 'subscribe' to : teslamate/cars/1/+ (in my case)
This allows you to see the data coming in and then action outcomes in node red according to whatever you want etc.
Or in my case I made a web page to see the state of the car, is it locked, the mileage, it's GPS location etc etc
Hope that makes sense...

The installation mentions Mosquitto, I assume this is an MQTT broker? If so, this is allready installed on the same system as teslamate, in the config files teslamate service file) it says

Environment="MQTT_HOST=127.0.0.1"

So I assume that this is enough to be able to access these values somehow, or am I still missing something? If this is correct, what link should I be using to view these values?

Again, apologies, but I'm not familiar with all these packages (elixir, grafana, mosquitto, ...) I'm used to "simple" PHP & javascript :)
 
A little step further: I found somewhere, that you need to add the following lines to the mosquitto.conf file:

Code:
listener 1883
protocol mqtt

listener 8883
protocol websockets

I've did that now, but now I see a lot of "Client <unknown> disconnected due to protocol error." lines in the mosquitto logs. I also see the following error in the mosquitto service status

Code:
New client connected from 127.0.0.1 as TESLAMATE_302E3131303 (p2, c1, k60).

This is new, since I edited the conf file. So I think I'm getting somewhere, but I'm still not there
 
it would seem then that perhaps with teslamate the broker is installed as well.
so firstly would need to see if the broker is reachable from anywhere on your network.
i use this on my linux PC (windoze version also available):
MQTT Explorer
and point the above program towards the ip of the broker (teslamate in your case) and see if it can connect.
If it does you should 'see' the data in there.
If not then the broker maybe either password protected or only reachable via localhost. Which would need a config change and restart the broker server.
 
it would seem then that perhaps with teslamate the broker is installed as well.
so firstly would need to see if the broker is reachable from anywhere on your network.
i use this on my linux PC (windoze version also available):
MQTT Explorer
and point the above program towards the ip of the broker (teslamate in your case) and see if it can connect.
If it does you should 'see' the data in there.
If not then the broker maybe either password protected or only reachable via localhost. Which would need a config change and restart the broker server.
If you use the docker installation, MQTT broker mosquito is installed by default as a service. I know @Houseofdreams mentioned is is not a docker install, but just sharing.
mosquitto:
image: eclipse-mosquitto:2
restart: always
command: mosquitto -c /mosquitto-no-auth.conf
# ports:
# - 1883:1883
volumes:
- mosquitto-conf:/mosquitto/config
- mosquitto-data:/mosquitto/data
Totally unrelated to TeslaMate, but I still need to learn / look into what a MQTT service can actually do for me. @26ct2143 explanation helps. Just not sure what else it could do for me.
 
it would seem then that perhaps with teslamate the broker is installed as well.
so firstly would need to see if the broker is reachable from anywhere on your network.
i use this on my linux PC (windoze version also available):
MQTT Explorer
and point the above program towards the ip of the broker (teslamate in your case) and see if it can connect.
If it does you should 'see' the data in there.
If not then the broker maybe either password protected or only reachable via localhost. Which would need a config change and restart the broker server.

I've downloaded this MQTT explorer, entered the correct ip (no username/password) and it connects without problems
mqqt_explorer.png


So far so good it seems. Do you use this MQTT serivce yourself? Because when I enter http://10.10.10.225:1883/cars/1/state it still gives me nothing in response
 
If you use the docker installation, MQTT broker mosquito is installed by default as a service. I know @Houseofdreams mentioned is is not a docker install, but just sharing.

Totally unrelated to TeslaMate, but I still need to learn / look into what a MQTT service can actually do for me. @26ct2143 explanation helps. Just not sure what else it could do for me.
What can MQTT do....?
So for me an example of some things.
MQTT is the central IoT broker that receives messages and responds to subscriptions.

So let's say I make a small low power (cheap about £10) microcontroller (ESP32) to read temperature of the downstairs in my house.
The controller is v v simple and slow, but I code it to read the temp sensor and send the reading (via it's wifi) to the MQTT broker every 20 sec (or whatever).
That's all the controller will do (forever).

Then another device (raspberry pi in my case (way more powerful)) is coded to subscribe to the same topic that the controller above is publishing to.
every 20s it now knows the temp of the downstairs. My Pi is connected to my heating pumps and motorised valves in the house. So it can now decide to switch on the heating (or not).

but maybe we want to use this temperature reading for other stuff. My car charger does MQTT. Using some code on Node red I could get the temp from the MQTT broker of the downstairs and tell it to charge the car at 10amps if the downstairs is >20C. Why you would want that I don't know, but you can see that you publish a reading once, then reuse it as many times as you want elsewhere.

MQTT is like the central hub of your network where all readings come into and actions take place from there. Even reactions to the actions and so on.
 
  • Helpful
Reactions: cwanja
I've downloaded this MQTT explorer, entered the correct ip (no username/password) and it connects without problems
View attachment 761347

So far so good it seems. Do you use this MQTT serivce yourself? Because when I enter http://10.10.10.225:1883/cars/1/state it still gives me nothing in response
so the MQTT is not a webserver, you can't type that into a browser, you use a javascript library to pull the reading into the browser, using a 'subscribe' method. I will post some code
 
Here is some code in HTML and javascript that I put together from bits across the web and some of my own.
For this to work you will need a webserver running in your network to upload it to.
You also need the MQTT library: mqttws31.min.js uploaded to the webserver. (and linked through correctly, see top of my code)
The IP in my code for the MQTT broker will need changing, also the subscription topic must match your broker's teslamate's topic.

Sorry had to attach, since the forum won't accept it in line... not sure why, errors out...
darn... still not working, will try again....
 

Attachments

  • index.html.zip
    1.3 KB · Views: 48
sorry for the zip file attachement above, but the forum doesn't seem to play nice with posting HTML code.
No idea why

Edit: another thing for this to work, the MQTT broker will need websockets enabled...
See the bit about port 9001 in the conf file:

port 1883
protocol mqtt

listener 9001
protocol websockets