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.
The car doesn't report it's actual consumption via the API, Teslamate has to calculate it from the observed trip distance, reported battery level and reported current range.

You can see an example of the data available from the unofficial API documentation below:
JSON:
{
  "response": {
    "id": 45226696177987462,
    "user_id": 134950,
    "vehicle_id": 163057375,
    "vin": ":vin",
    "display_name": ":name",
    "option_codes": "AD15,AF02,AH00,APF0,APH2,APPA,AU00,BCMB,BP00,BR00,BS00,BTX4,CC02,CDM0,CH05,COUS,CW02,DRLH,DSH7,DV4W,FG02,FR01,GLFR,HC00,HP00,IDBO,INBPB,IX01,LP01,LT3B,MDLX,ME02,MI02,PF00,PI01,PK00,PMBL,QLPB,RCX0,RENA,RFPX,S02B,SP00,SR04,ST02,SU01,TIC4,TM00,TP03,TR01,TRA1,TW01,UM01,USSB,UTAB,WT20,X001,X003,X007,X011,X014,X021,X025,X026,X028,X031,X037,X040,X042,YFFC,SC05",
    "color": null,
    "tokens": [
      ":token1",
      ":token2"
    ],
    "state": "online",
    "in_service": false,
    "id_s": ":ids",
    "calendar_enabled": true,
    "api_version": 6,
    "backseat_token": null,
    "backseat_token_updated_at": null,
    "charge_state": {
      "battery_heater_on": false,
      "battery_level": 74,
      "battery_range": 186.57,
      "charge_current_request": 48,
      "charge_current_request_max": 48,
      "charge_enable_request": true,
      "charge_energy_added": 29.64,
      "charge_limit_soc": 90,
      "charge_limit_soc_max": 100,
      "charge_limit_soc_min": 50,
      "charge_limit_soc_std": 90,
      "charge_miles_added_ideal": 117.0,
      "charge_miles_added_rated": 91.5,
      "charge_port_cold_weather_mode": null,
      "charge_port_door_open": false,
      "charge_port_latch": "Engaged",
      "charge_rate": 0.0,
      "charge_to_max_range": false,
      "charger_actual_current": 0,
      "charger_phases": null,
      "charger_pilot_current": 48,
      "charger_power": 0,
      "charger_voltage": 0,
      "charging_state": "Disconnected",
      "conn_charge_cable": "<invalid>",
      "est_battery_range": 146.18,
      "fast_charger_brand": "<invalid>",
      "fast_charger_present": false,
      "fast_charger_type": "<invalid>",
      "ideal_battery_range": 238.93,
      "managed_charging_active": false,
      "managed_charging_start_time": null,
      "managed_charging_user_canceled": false,
      "max_range_charge_counter": 0,
      "not_enough_power_to_heat": false,
      "scheduled_charging_pending": false,
      "scheduled_charging_start_time": null,
      "time_to_full_charge": 0.0,
      "timestamp": 1558229319159,
      "trip_charging": false,
      "usable_battery_level": 74,
      "user_charge_enable_request": null
    },
    "climate_state": {
      "battery_heater": false,
      "battery_heater_no_power": false,
      "climate_keeper_mode": "off",
      "driver_temp_setting": 20.0,
      "fan_status": 0,
      "inside_temp": 29.0,
      "is_auto_conditioning_on": false,
      "is_climate_on": false,
      "is_front_defroster_on": false,
      "is_preconditioning": false,
      "is_rear_defroster_on": false,
      "left_temp_direction": -240,
      "max_avail_temp": 28.0,
      "min_avail_temp": 15.0,
      "outside_temp": 24.0,
      "passenger_temp_setting": 20.0,
      "remote_heater_control_enabled": false,
      "right_temp_direction": -240,
      "seat_heater_left": 0,
      "seat_heater_rear_left": 0,
      "seat_heater_rear_right": 0,
      "seat_heater_right": 0,
      "seat_heater_third_row_left": 0,
      "seat_heater_third_row_right": 0,
      "side_mirror_heaters": false,
      "smart_preconditioning": false,
      "steering_wheel_heater": false,
      "timestamp": 1558229319159,
      "wiper_blade_heater": false
    },
    "drive_state": {
      "gps_as_of": 1558229088,
      "heading": 163,
      "latitude": 40.459698,
      "longitude": -79.92347,
      "native_latitude": 40.459698,
      "native_location_supported": 1,
      "native_longitude": -79.92347,
      "native_type": "wgs",
      "power": null,
      "shift_state": null,
      "speed": null,
      "timestamp": 1558229319160
    },
    "gui_settings": {
      "gui_24_hour_time": false,
      "gui_charge_rate_units": "mi/hr",
      "gui_distance_units": "mi/hr",
      "gui_range_display": "Rated",
      "gui_temperature_units": "F",
      "timestamp": 1558229319160
    },
    "vehicle_config": {
      "can_accept_navigation_requests": true,
      "can_actuate_trunks": true,
      "car_special_type": "base",
      "car_type": "modelx",
      "charge_port_type": "US",
      "eu_vehicle": false,
      "exterior_color": "MetallicBlack",
      "has_air_suspension": true,
      "has_ludicrous_mode": false,
      "motorized_charge_port": true,
      "perf_config": "P1",
      "plg": true,
      "rear_seat_heaters": 3,
      "rear_seat_type": 3,
      "rhd": false,
      "roof_color": "None",
      "seat_type": 0,
      "spoiler_type": "Passive",
      "sun_roof_installed": 0,
      "third_row_seats": "FuturisFoldFlat",
      "timestamp": 1558229319160,
      "trim_badging": "90d",
      "wheel_type": "AeroTurbine20"
    },
    "vehicle_state": {
      "api_version": 6,
      "autopark_state_v2": "ready",
      "autopark_style": "dead_man",
      "calendar_supported": true,
      "car_version": "2019.12.1.1 4b1dd29",
      "center_display_state": 0,
      "df": 0,
      "dr": 0,
      "ft": 0,
      "homelink_nearby": false,
      "is_user_present": false,
      "last_autopark_error": "no_error",
      "locked": true,
      "media_state": {
        "remote_control_enabled": true
      },
      "notifications_supported": true,
      "odometer": 20101.093888,
      "parsed_calendar_supported": true,
      "pf": 0,
      "pr": 0,
      "remote_start": false,
      "remote_start_enabled": true,
      "remote_start_supported": true,
      "rt": 0,
      "sentry_mode": false,
      "software_update": {
        "expected_duration_sec": 2700,
        "status": ""
      },
      "speed_limit_mode": {
        "active": false,
        "current_limit_mph": 85.0,
        "max_limit_mph": 90,
        "min_limit_mph": 50,
        "pin_code_set": false
      },
      "sun_roof_percent_open": null,
      "sun_roof_state": "unknown",
      "timestamp": 1558229319158,
      "valet_mode": false,
      "vehicle_name": ":name"
    }
  }
}
Thanks!
So given that Wh/km is inferred from data returned from the API, together with assumed usable capacity of the battery, what is the difference between net and gross consumption?
 
Thanks!
So given that Wh/km is inferred from data returned from the API, together with assumed usable capacity of the battery, what is the difference between net and gross consumption?
From Not understanding what is "Gross Consumption" calculation or what it means...? · Issue #479 · adriankumpf/teslamate
"The gross consumption describes how much energy is used in total (including sentry mode, vampire drain etc). The value is calculated based on the loss of range between charges"
 
From Not understanding what is "Gross Consumption" calculation or what it means...? · Issue #479 · adriankumpf/teslamate
"The gross consumption describes how much energy is used in total (including sentry mode, vampire drain etc). The value is calculated based on the loss of range between charges"
Thanks for explaining. I thought gross consumption was calculated using the kWhs added from charges. So not even gross from how much kWh you got charged for at the charger 😜
 
I tried to ask here but nobody replied, any idea why is this happening and how to solve it?

Multiple times while a charge on AC, it seems that the car reaches the set maximum and then does trigger small recurrent charges every hour or so, this causes the charges section to have multiple charges indicated.
If the charging station has session fees in the geofence settings, the starting fees are added at every separate charge:
 
I'm sure I've seen that behaviour described in this forum. More an issue of the car than Teslamate IIRC. Let's search to see if we can find it. If not start a new thread.

Edit: Maybe this is the one I was thinking of:
 
Last edited:
I used to have remote access via PiVPN and wireguard. Worked great. However since I moved to TalkTalk from Virgin I can't get it to work and Ive tried a good few times. Any suggestions please?
Likely an issue with your new router. PiVPN requires UPnP to be enabled for it to automatically configure a hole to accept VPN connections over.

Worst case you can manually configure your TalkTalk router with a Port Forward to your PiVPN instead.
 
Is there a way to merge 2 Teslamate databases? I originally setup Teslamate on Windows 10 and have since bought a Raspberrypi. I tried to restore from a backup before I went on vacation but it didn't work. While I was gone, the power went out and the windows 10 database stopped working June 30th at 3:26 and the Raspberry pi started recording on June 30th at 6:10. If I only use the windows 10 database I will lose data for a week, if I use the Raspberrypi database I will lose the data from the first 3 months I owned the car. Any help is appreciated if it's possible.
 
Any guides out there on how to setup on lightsail or other services like app runner etc

There are a variety of different scenarios talked about here which may help? Might be a variation of Docker


Is there a way to merge 2 Teslamate databases? I originally setup Teslamate on Windows 10 and have since bought a Raspberrypi. I tried to restore from a backup before I went on vacation but it didn't work. While I was gone, the power went out and the windows 10 database stopped working June 30th at 3:26 and the Raspberry pi started recording on June 30th at 6:10. If I only use the windows 10 database I will lose data for a week, if I use the Raspberrypi database I will lose the data from the first 3 months I owned the car. Any help is appreciated if it's possible.

I had to delete an old car recentl;y to get rid of it from the dashboards as it was just getting in the way. It was 2 tables I needed to change, maybe looking at those and seeing if you can export and import the missing rows? If you know a little sql then I imagine its not that hard (but have a back up just in case!)

This was the few simple commands (kodeks entry) that I followed. There may be other tables you need to merge.

 
I used to have remote access via PiVPN and wireguard. Worked great. However since I moved to TalkTalk from Virgin I can't get it to work and Ive tried a good few times. Any suggestions please?
If TalkTalk are using Carrier Grade NAT (CGNAT) then you likely won't be able to run a server from home -- the "real" IP address your home broadband emerges from on the TalkTalk edge is not the same IP that your router has, and TalkTalk almost certainly won't let you setup a mapping from the external "real" IP to your router's "internal" IP. I would highly recommend Zen, not only do they not use CGNAT, but you get a static IP as part of their package.

If you can't switch away from TalkTalk, check out CloudFlare Tunnels. It's a little bit of software that runs on your internal network (the Pi in this case) and establishes an outbound (so it's not affected by the CGNAT) tunnel to CloudFlare and you can then do all sorts of cool stuff with this tunnel, including publishing a website (your internally hosted TeslaMate, for example) and you can even put authentication in front of it so it's not anonymously available to everyone.
 
  • Helpful
Reactions: Dave EV
I have happily used a 3rd party datalogger app (Teslamate) for a little over a year and have enjoyed the stats it provides. Having an API, albeit not officially supported, is a great part of Tesla ownership and, like many of you I'm sure, it certainly it tickles my inner geek!

Last week I put my car into the shop because a number of faults developed :
  1. SOS service required message displayed.
  2. Reverse camera didn't work.
  3. Autopilot and cruise control didn't work
  4. GPS map didn't update.
  5. Visualisations were not showing.
I tried the two steering-wheel button (and brake pedal) reboot but that did not resolve the fault so I booked it into service.

The Tesla service department just got back to me. After thoroughly checking the hardware components and related wiring they said that the fault was, ultimately, caused by a 3rd party app.

Around time of the fault, a component in the car (I will hopefully get details from their technical write up tomorrow), as part of its normal operation, rebooted. The Tesla tech's theory - supported by internal logs taken by Tesla - is that the reboot of this component coincided with the 3rd party app querying the car. The two actions together caused a bus contention that was not resolved and that subsequently prevented all the components on that bus from communicating; hence the large number of apparent faults.

Additionally, the car then did not sleep for 4 days solid, which Tesla informs me was also due to the actions of the 3rd party app. (Oddly the TeslaMate logs I have don't show any abnormal awake periods but I have no reason to doubt the Tesla techs.)

Another clue is that, around the time of the fault, Tesla revoked the API refresh token that Teslamate was using to query the car. (I only noticed that today because Tesla told me about the 3rd party app issue so I went to hunt logs!) I'll try to line up all the timestamps later if people are interested.

From chatting with the service techs, it seems Tesla's position is that the API and Tesla software ecosystem is a coherent whole and this is a good example why 3rd party API usage is not supported! Nonetheless, as a principle of hardware/firmware/software design, of which I have significant experience, I consider that behaviour a bug in the Tesla firmware. A web API should not be able to cause such faults.

So, has anyone else experienced such a fault? Or other weirdness. If you do... it might be the 3rd party app!

(Also posted to the Teslamate GitHub but I think it potentially applies to any 3rd party API scraper!)
 
I consider that behaviour a bug in the Tesla firmware. A web API should not be able to cause such faults.
No doubt. If this contention did happen as the Tesla Tech theorized, it's still a bug in the API.

I've don't use TeslaMate but have used TeslaFi for many years - nothing like this has ever happened. I hope they aren't charging you for this insight.
 
  • Like
Reactions: GtiMart
I used it for a year, trouble free, and the above then happened twice within the space of about a month so whilst I'm open minded and recognise I don't have the insight of the Tesla techs their logs and diagnostic tools, I remain somewhat skeptical about the conclusion reached.

I've turned off the Teslamate poller so we'll have to wait and see if it happens again.

I hope they aren't charging you for this insight
No, they did their diagnosis work as goodwill which I think is very kind. :)
 
As of one of the more recent fw upgrades (4 months or so) the contactor switch on the internal charger cycles every minute along with the suspension pump also cycling. This coincides directly with the polling of the API by Teslafi which sounds like a very similar app. Teslafi's position is they haven't changed anything and that it must be related to a firmware update bug. My car does not sleep when Teslafi is enabled no matter what settings I try to configure to enable sleep or deep sleep. I have basically disabled Teslafi until hopefully a firmware update fixes it.

I have 2020.48.37.6 pending install but want to wait a bit to see if there's any impact. Have had a horrible past with firmware updates breaking stuff on my P90DL
 
My car does not sleep when Teslafi is enabled no matter what settings I try to configure to enable sleep or deep sleep.
Mine does. One thing I've noticed however is that is only slept for short periods of time, maybe 15 minutes, before waking up. But I'm normally plugged in while in the garage too, even if at my desired SOC. Unplugging allowed mine to sleep like a baby . It had nothing to do with TeslaFi. Of course, YMMV.
 
Mine does. One thing I've noticed however is that is only slept for short periods of time, maybe 15 minutes, before waking up. But I'm normally plugged in while in the garage too, even if at my desired SOC. Unplugging allowed mine to sleep like a baby . It had nothing to do with TeslaFi. Of course, YMMV.
I wonder if this is maybe specific to cars with adjustable suspension. The front air pumps definitely cycle on after the contactors cycle.