tesla_api 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/apiary.apib +0 -710
  3. data/docs/SUMMARY.md +9 -5
  4. data/docs/api-basics/vehicles.md +2 -0
  5. data/docs/miscellaneous/README.md +9 -0
  6. data/docs/miscellaneous/endpoints.md +407 -0
  7. data/docs/vehicle/commands/README.md +45 -4
  8. data/docs/vehicle/commands/alerts.md +24 -0
  9. data/docs/vehicle/commands/charging.md +97 -0
  10. data/docs/vehicle/commands/climate.md +46 -0
  11. data/docs/vehicle/commands/doors.md +24 -0
  12. data/docs/vehicle/commands/media.md +92 -0
  13. data/docs/vehicle/commands/navigation.md +33 -0
  14. data/docs/vehicle/commands/remotestart.md +17 -0
  15. data/docs/vehicle/commands/softwareupdate.md +30 -0
  16. data/docs/vehicle/commands/speedlimit.md +74 -0
  17. data/docs/vehicle/commands/sunroof.md +19 -0
  18. data/docs/vehicle/commands/trunk.md +17 -0
  19. data/docs/vehicle/commands/valet.md +35 -0
  20. data/docs/vehicle/commands/wake.md +26 -0
  21. data/docs/vehicle/optioncodes.md +4 -0
  22. data/docs/vehicle/state/README.md +5 -1
  23. data/docs/vehicle/state/chargestate.md +35 -36
  24. data/docs/vehicle/state/climatestate.md +19 -20
  25. data/docs/vehicle/state/data.md +122 -108
  26. data/docs/vehicle/state/drivestate.md +7 -8
  27. data/docs/vehicle/state/guisettings.md +4 -5
  28. data/docs/vehicle/state/nearbychargingsites.md +12 -0
  29. data/docs/vehicle/state/vehiclestate.md +10 -7
  30. data/lib/tesla_api/vehicle.rb +25 -0
  31. data/lib/tesla_api/version.rb +1 -1
  32. data/spec/cassettes/vehicle-cancel_software_update.yml +100 -0
  33. data/spec/cassettes/vehicle-charge_port_door_close.yml +100 -0
  34. data/spec/cassettes/vehicle-data.yml +103 -0
  35. data/spec/cassettes/vehicle-navigation_request.yml +100 -0
  36. data/spec/cassettes/vehicle-nearby_charging_sites.yml +95 -0
  37. data/spec/cassettes/vehicle-schedule_software_update.yml +100 -0
  38. data/spec/lib/tesla_api/vehicle_spec.rb +47 -22
  39. metadata +18 -13
  40. data/spec/cassettes/vehicle-sun_roof_control-comfort.yml +0 -130
  41. data/spec/cassettes/vehicle-sun_roof_control-open.yml +0 -130
  42. data/spec/cassettes/vehicle-sun_roof_move-0.yml +0 -130
  43. data/spec/cassettes/vehicle-sun_roof_move-100.yml +0 -130
  44. data/spec/cassettes/vehicle-sun_roof_move-50.yml +0 -130
@@ -7,16 +7,57 @@ description: These endpoints issue various commands to the car.
7
7
  These commands alter the vehicles state and return a boolean `result` to indicate success.
8
8
 
9
9
  {% page-ref page="wake.md" %}
10
+
11
+ Wakes up the car from a sleeping state.
12
+
10
13
  {% page-ref page="alerts.md" %}
14
+
15
+ Controls for honking the horn and flashing the lights.
16
+
17
+ {% page-ref page="remotestart.md" %}
18
+
19
+ Start the car remotely.
20
+
21
+ {% page-ref page="speedlimit.md" %}
22
+
23
+ Limit the maximum speed of the car.
24
+
25
+ {% page-ref page="valet.md" %}
26
+
27
+ Enable Valet Mode and reset the in-car PIN.
28
+
11
29
  {% page-ref page="doors.md" %}
30
+
31
+ Lock and unlock the car.
32
+
12
33
  {% page-ref page="trunk.md" %}
34
+
35
+ Open and close the trunk and frunk.
36
+
13
37
  {% page-ref page="sunroof.md" %}
38
+
39
+ Open and close the panoramic sunroof.
40
+
14
41
  {% page-ref page="charging.md" %}
42
+
43
+ Control the charging of the car.
44
+
15
45
  {% page-ref page="climate.md" %}
46
+
47
+ Adjust the temperature settings of the car.
48
+
16
49
  {% page-ref page="media.md" %}
17
- {% page-ref page="nagivation.md" %}
18
- {% page-ref page="remotestart.md" %}
50
+
51
+ Control the media playing in the car.
52
+
53
+ {% page-ref page="navigation.md" %}
54
+
55
+ Start the navigation system.
56
+
19
57
  {% page-ref page="softwareupdate.md" %}
20
- {% page-ref page="speedlimit.md" %}
21
- {% page-ref page="valet.md" %}
58
+
59
+ Start an update of the car's software.
60
+
22
61
  {% page-ref page="calendar.md" %}
62
+
63
+ Synchronize a calendar with the car.
@@ -3,3 +3,27 @@
3
3
  Controls for honking the horn and flashing the lights.
4
4
 
5
5
  ## POST `/api/1/vehicles/{id}/command/honk_horn`
6
+
7
+ Honks the horn twice.
8
+
9
+ ### Response
10
+
11
+ ```json
12
+ {
13
+ "reason": "",
14
+ "result": true
15
+ }
16
+ ```
17
+
18
+ ## POST `/api/1/vehicles/{id}/command/flash_lights`
19
+
20
+ Flashes the headlights once.
21
+
22
+ ### Response
23
+
24
+ ```json
25
+ {
26
+ "reason": "",
27
+ "result": true
28
+ }
29
+ ```
@@ -1,3 +1,100 @@
1
1
  # Charging
2
2
 
3
+ Commands related to the charging of the vehicle.
3
4
 
5
+ ## POST `/api/1/vehicles/{id}/command/charge_port_door_open`
6
+
7
+ Opens the charge port.
8
+
9
+ ### Response
10
+
11
+ ```json
12
+ {
13
+ "reason": "",
14
+ "result": true
15
+ }
16
+ ```
17
+
18
+ ## POST `/api/1/vehicles/{id}/command/charge_port_door_close`
19
+
20
+ For vehicles with a motorized charge port, this closes it.
21
+
22
+ ### Response
23
+
24
+ ```json
25
+ {
26
+ "reason": "",
27
+ "result": true
28
+ }
29
+ ```
30
+
31
+ ## POST `/api/1/vehicles/{id}/command/charge_start`
32
+
33
+ If the car is plugged in but not currently charging, this will start it charging.
34
+
35
+ ### Response
36
+
37
+ ```json
38
+ {
39
+ "reason": "",
40
+ "result": true
41
+ }
42
+ ```
43
+
44
+ ## POST `/api/1/vehicles/{id}/command/charge_stop`
45
+
46
+ If the car is currently charging, this will stop it.
47
+
48
+ ### Response
49
+
50
+ ```json
51
+ {
52
+ "reason": "",
53
+ "result": true
54
+ }
55
+ ```
56
+
57
+ ## POST `/api/1/vehicles/{id}/command/charge_standard`
58
+
59
+ Sets the charge limit to "standard" or ~90%.
60
+
61
+ ### Response
62
+
63
+ ```json
64
+ {
65
+ "reason": "",
66
+ "result": true
67
+ }
68
+ ```
69
+
70
+ ## POST `/api/1/vehicles/{id}/command/charge_max_range`
71
+
72
+ Sets the charge limit to "max range" or 100%.
73
+
74
+ ### Response
75
+
76
+ ```json
77
+ {
78
+ "reason": "",
79
+ "result": true
80
+ }
81
+ ```
82
+
83
+ ## POST `/api/1/vehicles/{id}/command/set_charge_limit`
84
+
85
+ Sets the charge limit to a custom value.
86
+
87
+ ### Parameters
88
+
89
+ | Parameter | Example | Description |
90
+ | :-------- | :------ | :-------------------------------------------- |
91
+ | percent | 75 | The percentage the battery will charge until. |
92
+
93
+ ### Response
94
+
95
+ ```json
96
+ {
97
+ "reason": "",
98
+ "result": true
99
+ }
100
+ ```
@@ -1,3 +1,49 @@
1
1
  # Climate
2
2
 
3
+ ## POST `/api/1/vehicles/{id}/command/auto_conditioning_start`
3
4
 
5
+ Start the climate control (HVAC) system. Will cool or heat automatically, depending on set temperature.
6
+
7
+ ### Response
8
+
9
+ ```json
10
+ {
11
+ "reason": "",
12
+ "result": true
13
+ }
14
+ ```
15
+
16
+ ## POST `/api/1/vehicles/{id}/command/auto_conditioning_stop`
17
+
18
+ Stop the climate control (HVAC) system.
19
+
20
+ ### Response
21
+
22
+ ```json
23
+ {
24
+ "reason": "",
25
+ "result": true
26
+ }
27
+ ```
28
+
29
+ ## POST `/api/1/vehicles/{id}/command/set_temps`
30
+
31
+ Sets the target temperature for the climate control (HVAC) system.
32
+
33
+ Note: The parameters are always in celcius, regardless of the region the car is in or the display settings of the car.
34
+
35
+ ### Parameters
36
+
37
+ | Parameter | Example | Description |
38
+ | :------------- | :------ | :---------------------------------------------------------- |
39
+ | driver_temp | 23.4 | The desired temperature on the driver's side in celcius. |
40
+ | passenger_temp | 23.4 | The desired temperature on the passenger's side in celcius. |
41
+
42
+ ### Response
43
+
44
+ ```json
45
+ {
46
+ "reason": "",
47
+ "result": true
48
+ }
49
+ ```
@@ -1,3 +1,27 @@
1
1
  # Doors
2
2
 
3
+ ## POST `/api/1/vehicles/{id}/command/door_unlock`
3
4
 
5
+ Unlocks the doors to the car. Extends the handles on the S and X.
6
+
7
+ ### Response
8
+
9
+ ```json
10
+ {
11
+ "reason": "",
12
+ "result": true
13
+ }
14
+ ```
15
+
16
+ ## POST `/api/1/vehicles/{id}/command/door_lock`
17
+
18
+ Locks the doors to the car. Retracts the handles on the S and X, if they are extended.
19
+
20
+ ### Response
21
+
22
+ ```json
23
+ {
24
+ "reason": "",
25
+ "result": true
26
+ }
27
+ ```
@@ -1,3 +1,95 @@
1
1
  # Media
2
2
 
3
+ Controls the currently playing media in the car. For these commands to work, the car must be on.
4
+
5
+ ## POST `/api/1/vehicles/{id}/command/media_toggle_playback`
6
+
7
+ Toggles the media between playing and paused. For the radio, this mutes or unmutes the audio.
8
+
9
+ ### Response
10
+
11
+ ```json
12
+ {
13
+ "reason": "",
14
+ "result": true
15
+ }
16
+ ```
17
+
18
+ ## POST `/api/1/vehicles/{id}/command/media_next_track`
19
+
20
+ Skips to the next track in the current playlist.
21
+
22
+ ### Response
23
+
24
+ ```json
25
+ {
26
+ "reason": "",
27
+ "result": true
28
+ }
29
+ ```
30
+
31
+ ## POST `/api/1/vehicles/{id}/command/media_prev_track`
32
+
33
+ Skips to the previous track in the current playlist. Does nothing for streaming from Stitcher.
34
+
35
+ ### Response
36
+
37
+ ```json
38
+ {
39
+ "reason": "",
40
+ "result": true
41
+ }
42
+ ```
43
+
44
+ ## POST `/api/1/vehicles/{id}/command/media_next_fav`
45
+
46
+ Skips to the next saved favorite in the media system.
47
+
48
+ ### Response
49
+
50
+ ```json
51
+ {
52
+ "reason": "",
53
+ "result": true
54
+ }
55
+ ```
56
+
57
+ ## POST `/api/1/vehicles/{id}/command/media_prev_fav`
58
+
59
+ Skips to the previous saved favorite in the media system.
60
+
61
+ ### Response
62
+
63
+ ```json
64
+ {
65
+ "reason": "",
66
+ "result": true
67
+ }
68
+ ```
69
+
70
+ ## POST `/api/1/vehicles/{id}/command/media_volume_up`
71
+
72
+ Turns up the volume of the media system.
73
+
74
+ ### Response
75
+
76
+ ```json
77
+ {
78
+ "reason": "",
79
+ "result": true
80
+ }
81
+ ```
82
+
83
+ ## POST `/api/1/vehicles/{id}/command/media_volume_down`
84
+
85
+ Turns down the volume of the media system.
86
+
87
+ ### Response
88
+
89
+ ```json
90
+ {
91
+ "reason": "",
92
+ "result": true
93
+ }
94
+ ```
3
95
 
@@ -1,3 +1,36 @@
1
1
  # Navigation
2
2
 
3
+ ## POST `/api/1/vehicles/{id}/command/navigation_request`
3
4
 
5
+ Sends a location for the car to start navigation.
6
+
7
+ These docs take from the Android app, which sends the data in JSON form. However, a urlencoded POST body will work as well. The basic format to a request looks like this:
8
+
9
+ ```json
10
+ {
11
+ "type": "share_ext_content_raw",
12
+ "value": {
13
+ "android.intent.extra.TEXT": "123 Main St, City, ST 12345\n\nhttps://goo.gl/maps/X"
14
+ },
15
+ "locale": "en-US",
16
+ "timestamp_ms": "1539465730"
17
+ }
18
+ ```
19
+
20
+ ### Parameters
21
+
22
+ | Parameter | Example | Description |
23
+ | :------------------------------- | :-------------------------- | :------------------------------------------------ |
24
+ | type | share_ext_content_raw | Must be `share_ext_content_raw`. |
25
+ | locale | en-US | The locale for the navigation request. |
26
+ | timestamp_ms | 1539465730 | The current UNIX timestamp. |
27
+ | value[android.intent.extra.TEXT] | 123 Main St, City, ST 12345 | The address to set as the navigation destination. |
28
+
29
+ ### Response
30
+
31
+ ```json
32
+ {
33
+ "reason": "",
34
+ "result": true
35
+ }
36
+ ```
@@ -1,3 +1,20 @@
1
1
  # Remote Start
2
2
 
3
+ ## POST `/api/1/vehicles/{id}/command/remote_start_drive`
3
4
 
5
+ Enables keyless driving. There is a two minute window after issuing the command to start driving the car.
6
+
7
+ ### Parameters
8
+
9
+ | Parameter | Example | Description |
10
+ | :-------- | :-------- | :---------------------------------------------------- |
11
+ | password | edisonsux | The password for the authenticated tesla.com account. |
12
+
13
+ ### Response
14
+
15
+ ```json
16
+ {
17
+ "reason": "",
18
+ "result": true
19
+ }
20
+ ```
@@ -1,3 +1,33 @@
1
1
  # Software Updates
2
2
 
3
+ ## POST `/api/1/vehicles/{id}/command/schedule_software_update`
3
4
 
5
+ Schedules a software update to be installed, if one is available.
6
+
7
+ ### Parameters
8
+
9
+ | Parameter | Example | Description |
10
+ | :--------- | :------ | :------------------------------------------------------------------------------------- |
11
+ | offset_sec | 7200 | How many seconds in the future to schedule the update. Set to 0 for immediate install. |
12
+
13
+ ### Response
14
+
15
+ ```json
16
+ {
17
+ "reason": "",
18
+ "result": true
19
+ }
20
+ ```
21
+
22
+ ## POST `/api/1/vehicles/{id}/command/cancel_software_update`
23
+
24
+ Cancels a software update, if one is scheduled and has not yet started.
25
+
26
+ ### Response
27
+
28
+ ```json
29
+ {
30
+ "reason": "",
31
+ "result": true
32
+ }
33
+ ```