Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Model S REST API

This site may earn commission on affiliate links.
Maybe this is already known, but it seems like Tesla has an alternate address for the API or they are using client certs for additional auth. I was out testing and tried to capture some data and use Remote S and I couldn't login. I go to my.teslamotors.com and it says they are down for maintenance, but the official app continues to work without a problem.

Has this been seen before?
 
Maybe this is already known, but it seems like Tesla has an alternate address for the API or they are using client certs for additional auth. I was out testing and tried to capture some data and use Remote S and I couldn't login. I go to my.teslamotors.com and it says they are down for maintenance, but the official app continues to work without a problem.

Has this been seen before?

The official mobile apps login once and store the provided token for up to 90 days. The Auth server can be down and the mobile apps will keep working provided you don't logout.
 
Anyone have an idea whether there's a reliable API call to figure out if I remembered to plug in or not every night?

I wrote a script that calls https://owner-api.teslamotors.com/api/1/vehicles/$VEHICLEID/data_request/charge_state, but the returned json data blob doesn't seem reliable. There's a variable called "charge_port_door_open", but it comes back as either true, null or false seemingly at random, all while the car is plugged in.
 
Anyone have an idea whether there's a reliable API call to figure out if I remembered to plug in or not every night?

I wrote a script that calls https://owner-api.teslamotors.com/api/1/vehicles/$VEHICLEID/data_request/charge_state, but the returned json data blob doesn't seem reliable. There's a variable called "charge_port_door_open", but it comes back as either true, null or false seemingly at random, all while the car is plugged in.

In the json returned by the charge_state command, you want to see the value of "charging_state" set to either "Charging" or "Stopped" which indicates you are plugged in but not yet charging due to a timer.

A "charging_state" value of "null" or "Disconnected" should be a reliable trigger.
 
In the json returned by the charge_state command, you want to see the value of "charging_state" set to either "Charging" or "Stopped" which indicates you are plugged in but not yet charging due to a timer.

A "charging_state" value of "null" or "Disconnected" should be a reliable trigger.

Thanks, that's exactly what I needed. I'll update script and see how it goes for a few days.
 
Well that stinks. I guess that explains why they don't implement it on Android.

Not really. Android supports push notifications similar to the way iOS does. Actually, Google's Cloud Messaging works for iOS, too!

The reason the notifications have to come from Apple's push notification service is that apps are not generally allowed to run in the background on iOS, and thus the apps cannot send the notifications themselves. Android is a little more relaxed about this, but it's still bad for battery life if apps continually run in the background, polling the server. Anyway, Telsa could definitely implement notifications on Android if they wanted to.
 
Thanks Mark,

So if they do implement Update notifications on Android, the best way would be to use Google Cloud Messaging, but they might take a shortcut and add it to the API and then have the app poll occasionally. If they do that, then we would have a way to see it, correct?
 
Thanks Mark,

So if they do implement Update notifications on Android, the best way would be to use Google Cloud Messaging, but they might take a shortcut and add it to the API and then have the app poll occasionally. If they do that, then we would have a way to see it, correct?

Yeah, they could add it to the API and poll, I think. But that might have undesirable consequences for your phone's battery life, so push notifications is the way to go. I have no idea why they haven't implemented this.
 
Can someone confirm that the REST api still works with V7?
My first log with 7.0:
charging_state=Disconnected
charge_limit_soc=90
charge_limit_soc_std=90
charge_limit_soc_min=50
charge_limit_soc_max=100
charge_to_max_range=false
battery_heater_on=false
not_enough_power_to_heat=false
max_range_charge_counter=0
fast_charger_present=false
fast_charger_type=<invalid>
battery_range=210.99
est_battery_range=145.35
ideal_battery_range=272.53
battery_level=85
usable_battery_level=84
battery_current=-0.3
charge_energy_added=32.5
charge_miles_added_rated=105.0
charge_miles_added_ideal=135.5
charger_voltage=0
charger_pilot_current=0
charger_actual_current=0
charger_power=0
time_to_full_charge=0.0
trip_charging=false
charge_rate=0.0
charge_port_door_open=false
motorized_charge_port=true
scheduled_charging_start_time=null
scheduled_charging_pending=false
user_charge_enable_request=null
charge_enable_request=true
eu_vehicle=false
charger_phases=null
inside_temp=13.5
outside_temp=10.5
driver_temp_setting=22.0
passenger_temp_setting=22.0
is_auto_conditioning_on=false
is_front_defroster_on=3
is_rear_defroster_on=false
fan_status=0
seat_heater_left=0
seat_heater_right=0
seat_heater_rear_left=0
seat_heater_rear_right=0
seat_heater_rear_center=0
seat_heater_rear_right_back=0
seat_heater_rear_left_back=0
smart_preconditioning=false
shift_state=null
speed=null
latitude=...
longitude=...
heading=2
gps_as_of=1444907891
gui_distance_units=mi/hr
gui_temperature_units=F
gui_charge_rate_units=mi/hr
gui_24_hour_time=false
gui_range_display=Rated
api_version=3
calendar_supported=true
car_version=2.7.56
center_display_state=0
dark_rims=false
df=0
dr=0
exterior_color=Silver
ft=0
has_spoiler=true
locked=true
notifications_supported=true
odometer=13100.225705
parsed_calendar_supported=true
perf_config=P2
pf=0
pr=0
rear_seat_heaters=0
remote_start=false
remote_start_supported=true
rhd=false
roof_color=None
rt=0
seat_type=1
sun_roof_installed=1
sun_roof_percent_open=0
sun_roof_state=unknown
valet_mode=false
vehicle_name=Mercury
wheel_type=Turbine19

I haven't driven yet, so I can't confirm status of streaming.