It Has an API - What My Car Can Tell Me 🚙
Table of Contents
Introduction #
In my last post I talked about some of the things I thought of and found when ordering a car which is just as much a tech “gadget” as it is a car.
As someone who has only ever owned “traditional” cars in the past I was used to the interaction with the car being limited to when you are physically touching it, with remote locking being the exception.
When I first starting looking into EVs what you will see from most (if not all) manufacturers is that they have apps which allow you to interact with the car usually via its internet connectivity and therefore not requiring you to be in-sight or even in the same country as the car!
Usually these apps are used for things such as starting/stopping a charge, check the battery status of the car or perhaps one of the killer features (especially in winter) of starting the climate control from the comfort of your warm house!
With any tech product which is sold in the millions there are always enthusiast groups who end up finding new ways to utilise said product and Teslas are no different.
If we look at the app screenshot above you can see “Location” which shows the location of the car at the moment. When the car is driving you can also see its current location, speed as well as the destination if the driver is using the navigation within the car.
To be able to do all of this there has to be an API for the car and that is what people have leveraged to make something which usually wouldn’t be possible.
API #
The API which the official Tesla app as well as others use allows you to get information like below:
{
"response": {
"id": 12345678901234567,
"user_id": 123,
"vehicle_id": 1234567890,
"vin": "5YJSA11111111111",
"display_name": "Nikola 2.0",
"option_codes": "AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0",
"color": null,
"access_type": "OWNER",
"tokens": ["abcdef1234567890", "1234567890abcdef"],
"state": "online",
"in_service": false,
"id_s": "12345678901234567",
"calendar_enabled": true,
"api_version": 13,
"backseat_token": null,
"backseat_token_updated_at": null,
"drive_state": {
"gps_as_of": 1607623884,
"heading": 5,
"latitude": 33.111111,
"longitude": -88.111111,
"native_latitude": 33.111111,
"native_location_supported": 1,
"native_longitude": -88.111111,
"native_type": "wgs",
"power": -9,
"shift_state": null,
"speed": null,
"timestamp": 1607623897515
},
"climate_state": {
"battery_heater": false,
"battery_heater_no_power": false,
"climate_keeper_mode": "off",
"defrost_mode": 0,
"driver_temp_setting": 21.1,
"fan_status": 0,
"inside_temp": 22.1,
"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": -66,
"max_avail_temp": 28.0,
"min_avail_temp": 15.0,
"outside_temp": 18.0,
"passenger_temp_setting": 21.1,
"remote_heater_control_enabled": false,
"right_temp_direction": -66,
"seat_heater_left": 0,
"seat_heater_right": 0,
"side_mirror_heaters": false,
"timestamp": 1607623897515,
"wiper_blade_heater": false
},
"charge_state": {
"battery_heater_on": false,
"battery_level": 59,
"battery_range": 149.92,
"charge_current_request": 40,
"charge_current_request_max": 40,
"charge_enable_request": true,
"charge_energy_added": 2.42,
"charge_limit_soc": 90,
"charge_limit_soc_max": 100,
"charge_limit_soc_min": 50,
"charge_limit_soc_std": 90,
"charge_miles_added_ideal": 10.0,
"charge_miles_added_rated": 8.0,
"charge_port_cold_weather_mode": null,
"charge_port_door_open": true,
"charge_port_latch": "Engaged",
"charge_rate": 28.0,
"charge_to_max_range": false,
"charger_actual_current": 40,
"charger_phases": 1,
"charger_pilot_current": 40,
"charger_power": 9,
"charger_voltage": 243,
"charging_state": "Charging",
"conn_charge_cable": "SAE",
"est_battery_range": 132.98,
"fast_charger_brand": "<invalid>",
"fast_charger_present": false,
"fast_charger_type": "<invalid>",
"ideal_battery_range": 187.4,
"managed_charging_active": false,
"managed_charging_start_time": null,
"managed_charging_user_canceled": false,
"max_range_charge_counter": 0,
"minutes_to_full_charge": 165,
"not_enough_power_to_heat": false,
"scheduled_charging_pending": false,
"scheduled_charging_start_time": null,
"time_to_full_charge": 2.75,
"timestamp": 1607623897515,
"trip_charging": false,
"usable_battery_level": 59,
"user_charge_enable_request": null
},
"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",
"show_range_units": true,
"timestamp": 1607623897515
},
"vehicle_state": {
"api_version": 13,
"autopark_state_v2": "standby",
"autopark_style": "standard",
"calendar_supported": true,
"car_version": "2020.48.10 f8900cddd03a",
"center_display_state": 0,
"df": 0,
"dr": 0,
"fd_window": 0,
"fp_window": 0,
"ft": 0,
"homelink_device_count": 2,
"homelink_nearby": true,
"is_user_present": false,
"last_autopark_error": "no_error",
"locked": false,
"media_state": { "remote_control_enabled": true },
"notifications_supported": true,
"odometer": 57869.762487,
"parsed_calendar_supported": true,
"pf": 0,
"pr": 0,
"rd_window": 0,
"remote_start": false,
"remote_start_enabled": true,
"remote_start_supported": true,
"rp_window": 0,
"rt": 0,
"sentry_mode": false,
"sentry_mode_available": true,
"smart_summon_available": true,
"software_update": {
"download_perc": 0,
"expected_duration_sec": 2700,
"install_perc": 1,
"status": "",
"version": ""
},
"speed_limit_mode": {
"active": false,
"current_limit_mph": 85.0,
"max_limit_mph": 90,
"min_limit_mph": 50,
"pin_code_set": false
},
"summon_standby_mode_enabled": false,
"sun_roof_percent_open": 0,
"sun_roof_state": "closed",
"timestamp": 1607623897515,
"valet_mode": false,
"valet_pin_needed": true,
"vehicle_name": null
},
"vehicle_config": {
"can_accept_navigation_requests": true,
"can_actuate_trunks": true,
"car_special_type": "base",
"car_type": "models2",
"charge_port_type": "US",
"default_charge_to_max": false,
"ece_restrictions": false,
"eu_vehicle": false,
"exterior_color": "White",
"has_air_suspension": true,
"has_ludicrous_mode": false,
"motorized_charge_port": true,
"plg": true,
"rear_seat_heaters": 0,
"rear_seat_type": 0,
"rhd": false,
"roof_color": "None",
"seat_type": 2,
"spoiler_type": "None",
"sun_roof_installed": 2,
"third_row_seats": "None",
"timestamp": 1607623897515,
"trim_badging": "p90d",
"use_range_badging": false,
"wheel_type": "AeroTurbine19"
}
}
}
This information is great and it tells you a LOT about the car, its settings and even things such as the wheels and colour so it can show the correct model in the app.
One of the sections of the data is the current “drive state” of the vehicle:
{
"response": {
"gps_as_of": 1543187664,
"heading": 8,
"latitude": 33.111111,
"longitude": -88.111111,
"native_latitude": 33.111111,
"native_location_supported": 1,
"native_longitude": -88.111111,
"native_type": "wgs",
"power": 0,
"shift_state": null,
"speed": null,
"timestamp": 1543187666472
}
}
This is the information that the app uses to show the location and speed etc of the vehicle but wouldn’t it be cool if we could use it for other things?
Tessie #
This is where a cool app/platform called Tessie comes in, it is available as either a mobile app but also as a web platform and when you log into it will collect the data from the API above and use it to do a few things:
Information about the car #
This is pretty much the same information which is in normal Tesla app however if you’re using it for the other data as well it means you have it all in one place. As it uses the same API there aren’t any function that are available in the Tesla app that can’t be done in Tessie.
Battery information #
Using the information which the API is exposing and leveraging the data that Tessie has from other users means you can compare the current charge “health” of your battery.
This information is not perfect and it can’t replace a full battery diagnostic for the health of your battery but it can give you a rough idea on how your battery is doing compared to others.
Automation #
Because Tessie needs to have a server backend to be able to support the app and log all the information one of the things they now offer are “automations” which allow you to do loads of different things including:
- Every day
- When arriving at a location
- When leaving a location
- Once off
- Charging schedule (at a location)
My favourite automation is being able to set a charging schedule, for anyone who has a time-of-use home electricity tariff it is fairly common to have a period of time which is cheaper than the rest of the day, for my provider I have a “boost” period between 2-4am when the electricity is cheaper.
While Tesla have the ability to set a time for your charge to start or for your charge to end they don’t have (at the moment) the ability to tell both the start as well as the end times.
If I don’t need to do a long drive the next day I can utilise this automation to only charge as much as I can between 2-4am.
Charge costs #
One of the common uses I’ve seen for apps like Tessie is to be able to track how much it costs to charge your EV.
By “tagging” locations inside Tessie it is able to automatically record the price for locations where you charge often like your home or perhaps your work location.
Another bonus of that API is that it can also automatically record the price of Supercharger sessions as well.
If you charge at a location which isn’t “tagged” then you can go into that later on and fill in the information (e.g. once you get the charge on your credit card)
Another bonus is that it also charges information about your charge such as the energy and range added as well as the power of that charge which is nice to know as it clearly shows the charging curve of your cars battery.
Drives #
If we remember back to the information in the API we had the information about the location, speed etc of the car.
If you constantly track that information you have the perfect logging of a drive/journey.
Tessie can log everything about the journey including:
- Speed
- Elevation
- Battery
- Range
- Energy (e.g. average 188 Wh/km)
- Interior temperature
- Exterior temperature
By combining the information on the energy the drive used along with the average cost of charging in the last 30 days we can also see an estimate of the cost of that journey, its not exact but it gives you a good idea. You can also put into the app the current cost of fuel as well as the efficiency of an ICE vehicle to see how much that same journey would have cost you.
Conclusion #
There are ofcourse some risks with using third-party apps like Tessie, because there is no official Tesla developer API it means that you are trusting the developer with access to your Tesla API but this is something which you can decide is worth it for the value you get.
If you’re interested in trialling Tessie you can use my referral link and get a free months trial here.
This article isn’t sponsored and I’m only writing about it because I really enjoy using it and recommend it enough to other users that I thought it might be good to have a write-up about it.
In my next post I’ll be detailing an option similar to Tessie if you want to host your own system to store the same type of information Tessie uses.