├── .gitbook.yml ├── .github ├── FUNDING.yml └── workflows │ ├── formatting.yml │ └── test.yml ├── .gitignore ├── .prettierrc ├── .rspec ├── .standard.yml ├── .tool-versions ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── apiary.apib ├── docs ├── README.md ├── SUMMARY.md ├── api-basics │ ├── authentication.md │ ├── products.md │ ├── tripplan.md │ ├── users.md │ └── vehicles.md ├── energy │ ├── README.md │ ├── commands.md │ ├── history.md │ └── state.md ├── miscellaneous │ ├── README.md │ └── endpoints.md └── vehicle │ ├── autopark.md │ ├── commands │ ├── README.md │ ├── alerts.md │ ├── calendar.md │ ├── charging.md │ ├── climate.md │ ├── doors.md │ ├── homelink.md │ ├── media.md │ ├── misc.md │ ├── remotestart.md │ ├── sentrymode.md │ ├── sharing.md │ ├── softwareupdate.md │ ├── speedlimit.md │ ├── sunroof.md │ ├── trunk.md │ ├── valet.md │ ├── wake.md │ └── windows.md │ ├── optioncodes.md │ ├── state │ ├── README.md │ ├── chargestate.md │ ├── climatestate.md │ ├── data.md │ ├── drivestate.md │ ├── guisettings.md │ ├── misc.md │ ├── mobileenabled.md │ ├── nearbychargingsites.md │ ├── vehicleconfig.md │ └── vehiclestate.md │ └── streaming.md ├── lib ├── tesla_api.rb └── tesla_api │ ├── autopark.rb │ ├── client.rb │ ├── stream.rb │ ├── vehicle.rb │ └── version.rb ├── ownerapi_endpoints.json ├── spec ├── cassettes │ ├── client-login-mfa-invalid.yml │ ├── client-login-mfa.yml │ ├── client-login.yml │ ├── client-refresh.yml │ ├── client-vehicles.yml │ ├── vehicle-activate_speed_limit.yml │ ├── vehicle-auto_conditioning_start.yml │ ├── vehicle-auto_conditioning_stop.yml │ ├── vehicle-cancel_software_update.yml │ ├── vehicle-charge_max_range-twice.yml │ ├── vehicle-charge_max_range.yml │ ├── vehicle-charge_port_door_close.yml │ ├── vehicle-charge_port_door_open.yml │ ├── vehicle-charge_standard-twice.yml │ ├── vehicle-charge_standard.yml │ ├── vehicle-charge_start.yml │ ├── vehicle-charge_state.yml │ ├── vehicle-charge_stop.yml │ ├── vehicle-clear_speed_limit_pin.yml │ ├── vehicle-climate_state.yml │ ├── vehicle-data.yml │ ├── vehicle-deactivate_speed_limit.yml │ ├── vehicle-door_lock.yml │ ├── vehicle-door_unlock.yml │ ├── vehicle-drive_state.yml │ ├── vehicle-flash_lights.yml │ ├── vehicle-gui_settings.yml │ ├── vehicle-honk_horn.yml │ ├── vehicle-media_next_fav.yml │ ├── vehicle-media_next_track.yml │ ├── vehicle-media_prev_fav.yml │ ├── vehicle-media_prev_track.yml │ ├── vehicle-media_toggle_playback.yml │ ├── vehicle-media_volume_down.yml │ ├── vehicle-media_volume_up.yml │ ├── vehicle-mobile_enabled.yml │ ├── vehicle-navigation_request.yml │ ├── vehicle-nearby_charging_sites.yml │ ├── vehicle-open_frunk.yml │ ├── vehicle-open_trunk.yml │ ├── vehicle-remote_start_drive.yml │ ├── vehicle-reset_valet_pin.yml │ ├── vehicle-schedule_software_update.yml │ ├── vehicle-seat_heater_request.yml │ ├── vehicle-set_charge_limit-1.yml │ ├── vehicle-set_charge_limit-100.yml │ ├── vehicle-set_charge_limit-50.yml │ ├── vehicle-set_charge_limit-90.yml │ ├── vehicle-set_charging_amps-10.yml │ ├── vehicle-set_sentry_mode.yml │ ├── vehicle-set_speed_limit.yml │ ├── vehicle-set_temps-70-70.yml │ ├── vehicle-set_temps-75-65.yml │ ├── vehicle-set_valet_mode.yml │ ├── vehicle-steering_wheel_heater_request.yml │ ├── vehicle-sun_roof_control-close.yml │ ├── vehicle-sun_roof_control-vent.yml │ ├── vehicle-vehicle_config.yml │ ├── vehicle-vehicle_data.yml │ ├── vehicle-vehicle_state.yml │ ├── vehicle-wake_up.yml │ └── vehicle.yml ├── lib │ └── tesla_api │ │ ├── client_spec.rb │ │ └── vehicle_spec.rb └── spec_helper.rb ├── tesla_api.gemspec └── vault.proto /.gitbook.yml: -------------------------------------------------------------------------------- 1 | root: ./docs/ 2 | structure: 3 | readme: README.md 4 | summary: SUMMARY.md 5 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: timdorr 2 | -------------------------------------------------------------------------------- /.github/workflows/formatting.yml: -------------------------------------------------------------------------------- 1 | name: Formatting 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | paths: 7 | - docs/** 8 | pull_request: 9 | branches: [master] 10 | paths: 11 | - docs/** 12 | 13 | jobs: 14 | test: 15 | name: Check docs formatting 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v3 20 | 21 | - name: Check formatting 22 | uses: creyD/prettier_action@v4.3 23 | with: 24 | prettier_options: --check docs 25 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | test: 11 | name: Test Suite 12 | runs-on: ubuntu-latest 13 | 14 | env: 15 | TESLA_EMAIL: elon.musk@teslamotors.com 16 | TESLA_PASS: oilLOL 17 | TESLA_CLIENT_ID: 1 18 | TESLA_CLIENT_SECRET: 2 19 | TESLA_ACCESS_TOKEN: 3 20 | TESLA_REFRESH_TOKEN: 4 21 | 22 | strategy: 23 | matrix: 24 | ruby-version: ['2.7', '3.0', '3.1', '3.2'] 25 | 26 | steps: 27 | - uses: actions/checkout@v3 28 | 29 | - name: Set up Ruby 30 | uses: ruby/setup-ruby@v1 31 | with: 32 | ruby-version: ${{ matrix.ruby-version }} 33 | bundler-cache: true 34 | 35 | - name: Lint code 36 | run: bundle exec standardrb 37 | 38 | - name: Run test suite 39 | run: bundle exec rake 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | *.bundle 11 | *.so 12 | *.o 13 | *.a 14 | mkmf.log 15 | .ruby-version 16 | .ruby-gemset 17 | .env 18 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format documentation 3 | --require spec_helper 4 | -------------------------------------------------------------------------------- /.standard.yml: -------------------------------------------------------------------------------- 1 | format: progress 2 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | ruby 3.2.2 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gemspec 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-Present Tim Dorr 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Referrals are back! Need a vehicle to test with? [Get a Tesla with free supercharging](http://ts.la/timothy8449) 2 | 3 | Do you work at Tesla? Get in contact! I'd love to help with making this API official. 4 | 5 | # Tesla JSON API 6 | 7 | [View Documentation](https://tesla-api.timdorr.com/) 8 | 9 | This is unofficial documentation of the Tesla JSON API used by the iOS and Android apps. 10 | The API provides functionality to monitor and control the Model S (and future Tesla vehicles) remotely. 11 | The project provides both a documentation of the API and a Ruby library for accessing it. 12 | 13 | > If any folks at Tesla are reading this, I'd love to help coordinate a developer program for your APIs. If there's any way I can be helpful, please feel free to get in contact. Also, I'd love to be in the beta firmware program :wink: 14 | 15 | ## Ruby Gem [![Gem Version](https://img.shields.io/gem/v/tesla_api.svg)](http://rubygems.org/gems/tesla_api) [![Build Status](https://img.shields.io/travis/timdorr/tesla-api/master.svg)](https://travis-ci.org/timdorr/tesla-api) 16 | 17 | This gem provides a basic wrapper around the API to easily query and command the car remotely. 18 | It also provides access to the streaming API and a means to process data coming from it. 19 | 20 | ## Installation 21 | 22 | Add this line to your application's Gemfile: 23 | 24 | ```ruby 25 | gem 'tesla_api' 26 | ``` 27 | 28 | Or install it yourself: 29 | 30 | ```sh 31 | gem install tesla_api 32 | ``` 33 | 34 | ## Usage 35 | 36 | Here's a quick example: 37 | 38 | ```ruby 39 | require 'tesla_api' 40 | 41 | tesla_api = TeslaApi::Client.new(email: email, client_id: client_id, client_secret: client_secret) 42 | tesla_api.login!(password) 43 | # Or if you have an access token: 44 | tesla_api = TeslaApi::Client.new(access_token: access_token) 45 | 46 | model_s = tesla_api.vehicles.first # => 47 | 48 | model_s.wake_up 49 | vehicle_data = model_s.vehicle_data 50 | model_s.auto_conditioning_start unless vehicle_data["climate_state"]["is_auto_conditioning_on"] 51 | 52 | model_s.set_charge_limit(90) 53 | model_s.charge_start 54 | 55 | charge_state = vehicle_data["charge_state"] 56 | puts "Your Model S is #{charge_state["charging_state"]} " + 57 | "with a SOC of #{charge_state["battery_level"]}% " + 58 | "and an estimate range of #{charge_state["est_battery_range"]} miles" 59 | ``` 60 | 61 | ## Copyright 62 | 63 | Ruby portions are Copyright (c) 2014-Present Tim Dorr. Released under the terms of the 64 | MIT license. See LICENSE for details. 65 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "rspec/core/rake_task" 3 | require "standard/rake" 4 | 5 | RSpec::Core::RakeTask.new(:spec) do |task| 6 | task.rspec_opts = ["--color", "--format", "documentation", "--require", "spec_helper"] 7 | end 8 | 9 | desc "Open an irb session preloaded with this library" 10 | task :console do 11 | # Load all gems 12 | require "rubygems" 13 | require "bundler/setup" 14 | Bundler.require(:default) 15 | 16 | # Load the envs 17 | require "dotenv" 18 | Dotenv.load! 19 | 20 | # Set up a global client 21 | require "rotp" 22 | 23 | def mfa_code 24 | ROTP::TOTP.new(ENV["TESLA_TOTP"]).now 25 | end 26 | 27 | def client 28 | @client ||= TeslaApi::Client.new(access_token: ENV["TESLA_ACCESS_TOKEN"]) 29 | end 30 | 31 | # Load IRB 32 | require "irb" 33 | require "irb/completion" 34 | 35 | IRB.conf[:PROMPT_MODE] = :SIMPLE 36 | IRB.conf[:AUTO_INDENT] = true 37 | 38 | ARGV.clear 39 | IRB.start 40 | end 41 | 42 | task default: :spec 43 | -------------------------------------------------------------------------------- /apiary.apib: -------------------------------------------------------------------------------- 1 | FORMAT: 1A 2 | HOST: https://owner-api.teslamotors.com 3 | 4 | # Tesla Model S JSON API 5 | 6 | # ⚠️ ⚠️ ⚠️ ⚠️ 7 | # This site has moved! [https://tesla-api.timdorr.com/](https://tesla-api.timdorr.com/) 8 | # ⚠️ ⚠️ ⚠️ ⚠️ 9 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | This is unofficial documentation of the Tesla JSON API used by their iOS and Android apps. It features functionality to monitor and control their vehicle (Models S, 3, X, Y) and power (Powerwall) products. We currently have documentation for their vehicles, but always accept [pull requests](https://github.com/timdorr/tesla-api/pulls) for improvements and additions. 4 | 5 | If you want to use Tesla's Bluetooth Low Energy (BLE) protocol to communicate with the car instead, [there is a separate documentation project for it](https://teslabtapi.lexnastin.com). 6 | 7 | ## Before You Begin 8 | 9 | The base URI for all requests is `https://owner-api.teslamotors.com/` (except for the Streaming and Autopark APIs) 10 | 11 | > If you are in China, the URI for requests is going to be `owner-api.vn.cloud.tesla.cn` for you.
12 | > Keep in mind to replace all `auth.tesla.com` URLs to `auth.tesla.cn` as well. 13 | 14 | _All requests require a_ `User-Agent` _header with any value provided._ For Tesla's sake, it's recommended you identify your application in some way using this header. 15 | 16 | ## API Organization 17 | 18 | The API for vehicles is organized into 3 primary surfaces: 19 | 20 | ### State and commands 21 | 22 | Gives point-in-time data about the state of the vehicle and basic controls over certain functions of the vehicle. The state and command APIs loosely adhere to the REST standard, but differ in some crucial ways. As a result, you may not be able to use it with many REST tools and libraries out of the box. 23 | 24 | ### Streaming telemetry 25 | 26 | Streams in data about the car's telemetry at up to half second increments. The underlying protocol is simply a streaming HTTP API that provides JSON objects at regular intervals. 27 | 28 | ### Autopark ("Summon") 29 | 30 | A streaming command mode to control the automatic parking of HW1 (older Autopilot-only) and HW2/3 (FSD-capable) cars. This API uses a standard WebSocket that exchanges JSON objects to convey state information and issue commands during the Autopark session. 31 | -------------------------------------------------------------------------------- /docs/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Table of contents 2 | 3 | - [Introduction](README.md) 4 | 5 | ## API Basics 6 | 7 | - [Authentication](api-basics/authentication.md) 8 | - [Users](api-basics/users.md) 9 | - [Vehicles](api-basics/vehicles.md) 10 | - [Energy Products](api-basics/products.md) 11 | - [Trip Planner](api-basics/tripplan.md) 12 | 13 | ## Vehicle 14 | 15 | - [State](vehicle/state/README.md) 16 | - [Data](vehicle/state/data.md) 17 | - [Charge State](vehicle/state/chargestate.md) 18 | - [Climate State](vehicle/state/climatestate.md) 19 | - [Drive State](vehicle/state/drivestate.md) 20 | - [GUI Settings](vehicle/state/guisettings.md) 21 | - [Vehicle State](vehicle/state/vehiclestate.md) 22 | - [Vehicle Config](vehicle/state/vehicleconfig.md) 23 | - [Mobile Enabled](vehicle/state/mobileenabled.md) 24 | - [Nearby Charging Sites](vehicle/state/nearbychargingsites.md) 25 | - [Miscellaneous](vehicle/state/misc.md) 26 | - [Commands](vehicle/commands/README.md) 27 | - [Wake](vehicle/commands/wake.md) 28 | - [Alerts](vehicle/commands/alerts.md) 29 | - [Remote Start](vehicle/commands/remotestart.md) 30 | - [Homelink](vehicle/commands/homelink.md) 31 | - [Speed Limit](vehicle/commands/speedlimit.md) 32 | - [Valet Mode](vehicle/commands/valet.md) 33 | - [Sentry Mode](vehicle/commands/sentrymode.md) 34 | - [Doors](vehicle/commands/doors.md) 35 | - [Frunk/Trunk](vehicle/commands/trunk.md) 36 | - [Windows](vehicle/commands/windows.md) 37 | - [Sunroof](vehicle/commands/sunroof.md) 38 | - [Charging](vehicle/commands/charging.md) 39 | - [Climate](vehicle/commands/climate.md) 40 | - [Media](vehicle/commands/media.md) 41 | - [Sharing](vehicle/commands/sharing.md) 42 | - [Software Updates](vehicle/commands/softwareupdate.md) 43 | - [Calendar](vehicle/commands/calendar.md) 44 | - [Miscellaneous](vehicle/commands/misc.md) 45 | - [Streaming](vehicle/streaming.md) 46 | - [Autopark/Summon](vehicle/autopark.md) 47 | - [Option Codes](vehicle/optioncodes.md) 48 | 49 | ## Energy Products 50 | 51 | - [Overview](energy/README.md) 52 | - [History](energy/history.md) 53 | - [State](energy/state.md) 54 | - [Commands](energy/commands.md) 55 | 56 | ## Miscellaneous 57 | 58 | - [Endpoints File](miscellaneous/endpoints.md) 59 | -------------------------------------------------------------------------------- /docs/api-basics/products.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Endpoints for getting an account's energy products 3 | --- 4 | 5 | # Products 6 | 7 | A logged in user may have multiple Tesla Energy products (Powerwalls, Solar installations, etc.) under their account (congrats on being rich!). 8 | 9 | ## GET `/api/1/products` 10 | 11 | Retrieve a list of your Tesla Energy products. 12 | 13 | The value of `energy_site_id` is used as `site_id` in the various energy product endpoints. 14 | 15 | ### Request parameters 16 | 17 | ### Response 18 | 19 | ```json 20 | { 21 | "response": [ 22 | { 23 | "energy_site_id": 2252147638651575, 24 | "resource_type": "solar", 25 | "id": "313dbc37-555c-45b1-83aa-62a4ef9ff7ac", 26 | "asset_site_id": "47d04752-9cf1-4e76-88fb-08839a1c41c4", 27 | "solar_power": 2320, 28 | "solar_type": "pv_panel", 29 | "sync_grid_alert_enabled": false, 30 | "breaker_alert_enabled": false, 31 | "components": { 32 | "battery": false, 33 | "solar": true, 34 | "solar_type": "pv_panel", 35 | "grid": true, 36 | "load_meter": false, 37 | "market_type": "residential" 38 | } 39 | } 40 | ], 41 | "count": 1 42 | } 43 | ``` 44 | -------------------------------------------------------------------------------- /docs/api-basics/users.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Endpoints for getting information about the current user 3 | --- 4 | 5 | # Users 6 | 7 | These endpoints provide data on the current user. 8 | 9 | ## GET `/api/1/users/me` 10 | 11 | Get the current user's information. 12 | 13 | ### Response 14 | 15 | ```json 16 | { 17 | "email": "elon@tesla.com", 18 | "full_name": "Elon Musk", 19 | "profile_image_url": "https://vehicle-files.prd.euw1.vn.cloud.tesla.com/profile_images/{IMG}.jpg" 20 | } 21 | ``` 22 | 23 | ## GET `/api/1/users/vault_profile` 24 | 25 | {% hint style='info' %} 26 | This endpoint is a mystery and it's current purpose is unknown, but we know how to decode it. First of all take the `base64_data` and decode it. Finally, deserialize the message using the `Vault` message from protobuf located at https://github.com/timdorr/tesla-api/blob/master/vault.proto 27 | {% endhint %} 28 | 29 | ### Response 30 | 31 | ```json 32 | { 33 | "vault": "base64_data" 34 | } 35 | ``` 36 | 37 | ## GET `/api/1/users/feature_config` 38 | 39 | Get the feature configuration for the mobile app. 40 | 41 | ### Response 42 | 43 | ```json 44 | { 45 | "signaling": { 46 | "enabled": true, 47 | "subscribe_connectivity": false 48 | } 49 | } 50 | ``` 51 | 52 | ## POST `/api/1/users/keys` 53 | 54 | Update the name of a (bluetooth) key in all vehicles linked to the account. Refreshed inside the vehicle everytime the "Locks" menu is opened. 55 | 56 | `kind` and `public_key` must be set, everything else only needs to be set if you want to change it. 57 | 58 | ### Parameters 59 | 60 | | Parameter | Example | Description | 61 | | :--------- | :------------ | :-------------------------------------------------------------------------------------------------------------- | 62 | | kind | mobile_device | Must be "mobile_device" | 63 | | public_key | 04ed05567b... | The ANSI X9.62/X9.63 representation of the public key that you wish to change (65 bytes long) - as a hex string | 64 | | name | Sam's Phone | The name of the key (main text) | 65 | | model | iPhone 14 Pro | The model of the key (sub text) | 66 | 67 | ### Response 68 | 69 | ```json 70 | { 71 | "response": true 72 | } 73 | ``` 74 | -------------------------------------------------------------------------------- /docs/api-basics/vehicles.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Endpoints for getting an account's vehicles 3 | --- 4 | 5 | # Vehicles 6 | 7 | A logged in user can have multiple vehicles under their account (congrats on being rich!). This resource is primarily responsible for listing the vehicles and the basic details about them. 8 | 9 | #### `vehicle_id` vs `id` 10 | 11 | One potentially confusing part of Tesla's API is the switching use of the `id` and `vehicle_id` of the car. The `id` field is an identifier for the car on the owner-api endpoint. The `vehicle_id` field is for identifying the car across different endpoints, such as the streaming or Autopark APIs. 12 | 13 | For the state and command APIs, you should be using the `id` field. If your JSON parser doesn't support large numbers (>32 bit), then you can use the `id_s` field for a string version of the ID. 14 | 15 | ## GET `/api/1/vehicles?page={page}` 16 | 17 | Retrieve a list of your owned vehicles. 18 | 19 | The list is limited to a maximum of 100 entries. Use the `page` GET parameter to iterate over the response page and use 20 | the response `count` variable to determine if another request should be made. 21 | 22 | ### Request parameters 23 | 24 | | Field | Example | Description | Required | Default | 25 | | :----- | :------ | :-------------- | :------- | :------ | 26 | | `page` | `1` | The page number | no | 1 | 27 | 28 | ### Response 29 | 30 | ```json 31 | { 32 | "response": [ 33 | { 34 | "id": 12345678901234567, 35 | "vehicle_id": 1234567890, 36 | "vin": "5YJSA11111111111", 37 | "display_name": "Nikola 2.0", 38 | "color": null, 39 | "tokens": ["abcdef1234567890", "1234567890abcdef"], 40 | "state": "online", 41 | "in_service": false, 42 | "id_s": "12345678901234567", 43 | "calendar_enabled": true, 44 | "api_version": 7, 45 | "backseat_token": null, 46 | "backseat_token_updated_at": null 47 | } 48 | ], 49 | "count": 1 50 | } 51 | ``` 52 | 53 | ## GET `/api/1/vehicles/{id}` 54 | 55 | These resources are read-only and determine the state of the vehicle's various sub-systems. 56 | 57 | ### URL parameters 58 | 59 | | Field | Example | Description | 60 | | :---- | :------------------ | :------------------------------------------- | 61 | | `id` | `12345678901234567` | The `id` of the car. (Not the `vehicle_id`!) | 62 | 63 | ### Response 64 | 65 | ```json 66 | { 67 | "response": { 68 | "id": 12345678901234567, 69 | "vehicle_id": 1234567890, 70 | "vin": "5YJSA11111111111", 71 | "display_name": "Nikola 2.0", 72 | "color": null, 73 | "tokens": ["abcdef1234567890", "1234567890abcdef"], 74 | "state": "online", 75 | "in_service": false, 76 | "id_s": "12345678901234567", 77 | "calendar_enabled": true, 78 | "api_version": 7, 79 | "backseat_token": null, 80 | "backseat_token_updated_at": null 81 | } 82 | } 83 | ``` 84 | -------------------------------------------------------------------------------- /docs/energy/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Energy Products API Overview 3 | --- 4 | 5 | # Overview 6 | 7 | The base URI for all site-specific energy product endpoints is `https://owner-api.teslamotors.com/api/1/energy_sites/{site_id}/`. The `site_id` identifies the energy site installation and can be obtained from the [Energy Products API](../api-basics/products.md). 8 | 9 | ## Endpoints 10 | 11 | {% page-ref page="history.md" %} 12 | 13 | Get historical data about your energy products. 14 | 15 | {% page-ref page="state.md" %} 16 | 17 | Retrieve the current state of your energy products. 18 | 19 | {% page-ref page="commands.md" %} 20 | 21 | Commands to control your energy products. 22 | -------------------------------------------------------------------------------- /docs/energy/commands.md: -------------------------------------------------------------------------------- 1 | # Energy Commands 2 | 3 | These endpoints are not yet documented. 4 | 5 | | Cmd | Endpoint | 6 | | :--- | :---------------------------------- | 7 | | POST | `backup` | 8 | | POST | `off_grid_vehicle_charging_reserve` | 9 | | POST | `site_name` | 10 | | POST | `operation` | 11 | | POST | `grid_import_export` | 12 | | POST | `time_of_use_settings` | 13 | | POST | `command` | 14 | | POST | `program` | 15 | | POST | `event` | 16 | | POST | `preference` | 17 | 18 | ## POST `api/1/energy_sites/{site_id}/backup` 19 | 20 | Set the battery backup reserve energy percentage for grid outages. 21 | 22 | ### Parameters 23 | 24 | | Parameter | Example | Description | 25 | | :--------------------- | :------ | :--------------------------------- | 26 | | backup_reserve_percent | 75 | The percentage for backup reserve. | 27 | 28 | ### Response 29 | 30 | ```json 31 | { 32 | "response": { 33 | "code": 201, 34 | "message": "Updated" 35 | } 36 | } 37 | ``` 38 | 39 | ## POST `api/1/energy_sites/{site_id}/site_name` 40 | 41 | Set your energy site name. 42 | 43 | ### Parameters 44 | 45 | | Parameter | Example | Description | 46 | | :-------- | :----------- | :-------------------- | 47 | | site_name | Wardenclyffe | New energy site name. | 48 | 49 | ### Response 50 | 51 | ```json 52 | { 53 | "response": { 54 | "code": 201, 55 | "message": "Updated" 56 | } 57 | } 58 | ``` 59 | 60 | ## POST `api/1/energy_sites/{site_id}/storm_mode` 61 | 62 | Enable or disable Storm Watch. 63 | 64 | ### Parameters 65 | 66 | | Parameter | Example | Description | 67 | | :--------------------- | :------ | :--------------------------------- | 68 | | enabled | true | If Storm Watch should be enabled | 69 | 70 | ### Response 71 | 72 | ```json 73 | { 74 | "response": { 75 | "code": 201, 76 | "message": "Updated" 77 | } 78 | } 79 | ``` 80 | -------------------------------------------------------------------------------- /docs/miscellaneous/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Miscellaneous API information 3 | --- 4 | 5 | # Miscellaneous API information 6 | 7 | {% page-ref page="endpoints.md" %} 8 | 9 | Contents of the endpoints file from the mobile app. 10 | -------------------------------------------------------------------------------- /docs/miscellaneous/endpoints.md: -------------------------------------------------------------------------------- 1 | # Endpoints File 2 | 3 | The latest endpoints file as of version 4.13.3 of the mobile apps is located here: [https://github.com/timdorr/tesla-api/blob/master/ownerapi_endpoints.json](https://github.com/timdorr/tesla-api/blob/master/ownerapi_endpoints.json) 4 | -------------------------------------------------------------------------------- /docs/vehicle/autopark.md: -------------------------------------------------------------------------------- 1 | # Autopark/Summon 2 | -------------------------------------------------------------------------------- /docs/vehicle/commands/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: These endpoints issue various commands to the car. 3 | --- 4 | 5 | # Commands 6 | 7 | These commands alter the vehicles state and return a boolean `result` to indicate success. 8 | 9 | {% page-ref page="wake.md" %} 10 | 11 | Wakes up the car from a sleeping state. 12 | 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="homelink.md" %} 22 | 23 | Open or close the primary garage door via Homelink. 24 | 25 | {% page-ref page="speedlimit.md" %} 26 | 27 | Limit the maximum speed of the car. 28 | 29 | {% page-ref page="valet.md" %} 30 | 31 | Enable Valet Mode and reset the in-car PIN. 32 | 33 | {% page-ref page="doors.md" %} 34 | 35 | Lock and unlock the car. 36 | 37 | {% page-ref page="trunk.md" %} 38 | 39 | Open and close the trunk and frunk. 40 | 41 | {% page-ref page="windows.md" %} 42 | 43 | Open and vent the windows. 44 | 45 | {% page-ref page="sunroof.md" %} 46 | 47 | Open and close the panoramic sunroof. 48 | 49 | {% page-ref page="charging.md" %} 50 | 51 | Control the charging of the car. 52 | 53 | {% page-ref page="climate.md" %} 54 | 55 | Adjust the temperature settings of the car. 56 | 57 | {% page-ref page="media.md" %} 58 | 59 | Control the media playing in the car. 60 | 61 | {% page-ref page="sharing.md" %} 62 | 63 | Share a location to navigate to or video to play in theatre mode. 64 | 65 | {% page-ref page="softwareupdate.md" %} 66 | 67 | Start an update of the car's software. 68 | 69 | {% page-ref page="sentrymode.md" %} 70 | 71 | Enable or disable Sentry Mode. 72 | 73 | {% page-ref page="calendar.md" %} 74 | 75 | Synchronize a calendar with the car. 76 | 77 | {% page-ref page="./misc.md" %} 78 | 79 | Miscellaneous features. (Changing vehicle name etc.) 80 | -------------------------------------------------------------------------------- /docs/vehicle/commands/alerts.md: -------------------------------------------------------------------------------- 1 | # Alerts 2 | 3 | Controls for honking the horn and flashing the lights. 4 | 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 | ``` 30 | -------------------------------------------------------------------------------- /docs/vehicle/commands/calendar.md: -------------------------------------------------------------------------------- 1 | # Calendar 2 | -------------------------------------------------------------------------------- /docs/vehicle/commands/doors.md: -------------------------------------------------------------------------------- 1 | # Doors 2 | 3 | ## POST `/api/1/vehicles/{id}/command/door_unlock` 4 | 5 | Unlocks the doors to the car. Extends the handles on the S. 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, if they are extended. 19 | 20 | ### Response 21 | 22 | ```json 23 | { 24 | "reason": "", 25 | "result": true 26 | } 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/vehicle/commands/homelink.md: -------------------------------------------------------------------------------- 1 | # Homelink 2 | 3 | ## POST `/api/1/vehicles/{id}/command/trigger_homelink` 4 | 5 | Opens or closes the primary Homelink device. The provided location must be in proximity of stored location of the Homelink device. 6 | 7 | ### Parameters 8 | 9 | | Parameter | Example | Description | 10 | | :-------- | :----------------- | :----------------- | 11 | | lat | 36.98765432109876 | Current latitude. | 12 | | lon | -77.12345678901234 | Current longitude. | 13 | 14 | ### Response 15 | 16 | ```json 17 | { 18 | "reason": "", 19 | "result": true 20 | } 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/vehicle/commands/media.md: -------------------------------------------------------------------------------- 1 | # Media 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 | ``` 95 | 96 | ## POST `/api/1/vehicles/{id}/command/adjust_volume` 97 | 98 | Adjusts the volume of the media system to the desired volume. 99 | 100 | ### Parameters 101 | 102 | This endpoint needs a single `volume` parameter passed inside of the POST body, and will tell you if it's missing. 103 | 104 | > Note: the endpoint accepts both a string and a numerical value for the volume parameter. It is also currently not present as a feature inside of the Tesla App despite working. 105 | 106 | | Parameter | Example | Description | 107 | | :-------- | :------ | :---------------------------------- | 108 | | volume | 1 | Numerical value or string from 0-11 | 109 | 110 | ```json 111 | { 112 | "volume": "1" 113 | } 114 | ``` 115 | 116 | ```json 117 | { 118 | "volume": 1 119 | } 120 | ``` 121 | 122 | ### Response 123 | 124 | ```json 125 | { 126 | "reason": "", 127 | "result": true 128 | } 129 | ``` 130 | -------------------------------------------------------------------------------- /docs/vehicle/commands/misc.md: -------------------------------------------------------------------------------- 1 | # Take Drive Note 2 | 3 | {% hint style='info' %} 4 | This endpoint currently returns `not_supported` as a response, due to not being implemented / enabled yet. 5 | {% endhint %} 6 | 7 | ## POST `/api/1/vehicles/{id}/command/take_drivenote` 8 | 9 | Take a drive note. (This feature might be related to the FSD beta bug reporting system.) 10 | 11 | ### Request 12 | 13 | This endpoint requires a singular parameter `note`, inside the POST body with the value being anything you want to note. 14 | 15 | ### Example 16 | 17 | ```json 18 | { 19 | "note": "42" 20 | } 21 | ``` 22 | 23 | ### Response 24 | 25 | ```json 26 | { 27 | "result": true, 28 | "reason": "" 29 | } 30 | ``` 31 | 32 |
33 | 34 | # Set Vehicle Name 35 | 36 | {% hint style='info' %} 37 | Previously the endpoint returned `not_supported` as a response, due to not being implemented / enabled yet. 38 | Later in app version 4.19.0-1639, the endpoint was removed from the `ownerapi_endpoints.json` file. 39 | As of App version 4.20.5 you can change your vehicle name on software versions 2023.12+ 40 | {% endhint %} 41 | 42 | ## POST `/api/1/vehicles/{id}/command/set_vehicle_name` 43 | 44 | Set your vehicles name. 45 | 46 | This endpoint requires a singular parameter `vehicle_name`, inside of the POST body, with any given name as a value. 47 | 48 | ### Example 49 | 50 | ```json 51 | { 52 | "vehicle_name": "Nikola" 53 | } 54 | ``` 55 | 56 | ### Response 57 | 58 | ```json 59 | { 60 | "result": true, 61 | "reason": "" 62 | } 63 | ``` 64 | 65 |
66 | 67 | # Screenshot 68 | 69 | ## GET `/api/1/vehicles/{id}/screenshot` 70 | 71 | Take a screenshot of both displays (IC & MCU), which can be retrieved via the vehicle's CAN/OBD interface by Tesla Service.
72 | This is can be triggered inside of the vehicle as well, by holding the lower left & right buttons (Model S & X pre-refresh) on the steering wheel for around 5-10 seconds, kind of like the scroll wheel MCU restart. 73 | 74 | > Note: No on-screen message will appear. 75 | 76 | ### Response 77 | 78 | ```json 79 | { 80 | "response": "teleforce-ab1c234d-1a23-12a3-12a3-ab123c456d7e" 81 | } 82 | ``` 83 | 84 | # Remote Boombox 85 | 86 | ## POST `/api/1/vehicles/{id}/command/remote_boombox` 87 | 88 | Let the car fart remotely on version 2022.44.25.1 and above or use boombox v2 on supported vehicles. 89 | 90 | ### Parameters 91 | 92 | This endpoint does not require a POST body to fart remotely but needs one to use boombox v2. 93 | 94 | | Parameter | Example | Description | 95 | | :-------- | :------ | :-------------------------------------- | 96 | | action | 0 | Numerical value representing the action | 97 | 98 | The available actions are: 99 | 100 | | Action | Corresponding numerical value | 101 | | :----- | :---------------------------- | 102 | | Fart | 0 | 103 | 104 | ### Example 105 | 106 | ```json 107 | { 108 | "action": 0 109 | } 110 | ``` 111 | 112 | ### Response 113 | 114 | ```json 115 | { 116 | "result": true, 117 | "reason": "" 118 | } 119 | ``` 120 | -------------------------------------------------------------------------------- /docs/vehicle/commands/remotestart.md: -------------------------------------------------------------------------------- 1 | # Remote Start 2 | 3 | ## POST `/api/1/vehicles/{id}/command/remote_start_drive` 4 | 5 | Enables keyless driving. There is a two minute window after issuing the command to start driving the car. 6 | 7 | ### Response 8 | 9 | ```json 10 | { 11 | "reason": "", 12 | "result": true 13 | } 14 | ``` 15 | -------------------------------------------------------------------------------- /docs/vehicle/commands/sentrymode.md: -------------------------------------------------------------------------------- 1 | # Sentry Mode 2 | 3 | ## POST `/api/1/vehicles/{id}/command/set_sentry_mode` 4 | 5 | Turns sentry mode on or off. 6 | 7 | ### Request 8 | 9 | This endpoint requires a singular parameter `on`, inside the POST body with the value set to `true` for enabling and `false` for disabling sentry mode. 10 | 11 | ### Example 12 | 13 | ```json 14 | { 15 | "on": "true" 16 | } 17 | ``` 18 | 19 | ### Response 20 | 21 | ```json 22 | { 23 | "reason": "", 24 | "result": true 25 | } 26 | ``` 27 | -------------------------------------------------------------------------------- /docs/vehicle/commands/sharing.md: -------------------------------------------------------------------------------- 1 | # Sharing 2 | 3 | ## POST `/api/1/vehicles/{id}/command/share` 4 | 5 | Sends a location for the car to start navigation or play a video in theatre mode. 6 | 7 | These docs take from the Android app, which sends the data in JSON form. However, a [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding) 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 | Note: This API was previously `navigation_request`, but has been updated to support video links as well. 21 | 22 | ### Parameters 23 | 24 | | Parameter | Example | Description | 25 | | :------------------------------- | :-------------------------- | :---------------------------------------------------------------------------------------------------------------------------------- | 26 | | type | share_ext_content_raw | Must be `share_ext_content_raw`. | 27 | | locale | en-US | The locale for the navigation request. [ISO 639-1 standard language codes](https://www.andiamo.co.uk/resources/iso-language-codes/) | 28 | | timestamp_ms | 1539465730 | The current UNIX timestamp. | 29 | | value[android.intent.extra.TEXT] | 123 Main St, City, ST 12345 | The address or video URL to set as the navigation destination. | 30 | 31 | ### Response 32 | 33 | ```json 34 | { 35 | "reason": "", 36 | "result": true 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /docs/vehicle/commands/softwareupdate.md: -------------------------------------------------------------------------------- 1 | # Software Updates 2 | 3 | ## POST `/api/1/vehicles/{id}/command/schedule_software_update` 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 | "expected_duration_sec": 3000, 18 | "reason": "", 19 | "result": true, 20 | "scheduled_time_ms": 1685735308001, 21 | "status": "scheduled", 22 | "warning_time_remaining_ms": 120000 23 | } 24 | ``` 25 | 26 | ## POST `/api/1/vehicles/{id}/command/cancel_software_update` 27 | 28 | Cancels a software update, if one is scheduled and has not yet started. 29 | 30 | ### Response 31 | 32 | ```json 33 | { 34 | "reason": "", 35 | "result": true 36 | } 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/vehicle/commands/speedlimit.md: -------------------------------------------------------------------------------- 1 | # Speed Limit 2 | 3 | ## POST `/api/1/vehicles/{id}/command/speed_limit_set_limit` 4 | 5 | Sets the maximum speed allowed when Speed Limit Mode is active. 6 | 7 | ### Parameters 8 | 9 | | Parameter | Example | Description | 10 | | :-------- | :------ | :--------------------------------------------- | 11 | | limit_mph | 65 | The speed limit in MPH. Must be between 50-90. | 12 | 13 | ### Response 14 | 15 | ```json 16 | { 17 | "reason": "", 18 | "result": true 19 | } 20 | ``` 21 | 22 | ## POST `/api/1/vehicles/{id}/command/speed_limit_activate` 23 | 24 | Activates Speed Limit Mode at the currently set speed. 25 | 26 | ### Parameters 27 | 28 | | Parameter | Example | Description | 29 | | :-------- | :------ | :--------------------------------------------------------- | 30 | | pin | 1234 | The existing PIN, if previously set, or a new 4 digit PIN. | 31 | 32 | ### Response 33 | 34 | ```json 35 | { 36 | "reason": "", 37 | "result": true 38 | } 39 | ``` 40 | 41 | ## POST `/api/1/vehicles/{id}/command/speed_limit_deactivate` 42 | 43 | Deactivates Speed Limit Mode if it is currently active. 44 | 45 | ### Parameters 46 | 47 | | Parameter | Example | Description | 48 | | :-------- | :------ | :------------------------------------------------- | 49 | | pin | 1234 | The 4 digit PIN used to activate Speed Limit Mode. | 50 | 51 | ### Response 52 | 53 | ```json 54 | { 55 | "reason": "", 56 | "result": true 57 | } 58 | ``` 59 | 60 | ## POST `/api/1/vehicles/{id}/command/speed_limit_clear_pin` 61 | 62 | Clears the currently set PIN for Speed Limit Mode. 63 | 64 | ### Parameters 65 | 66 | | Parameter | Example | Description | 67 | | :-------- | :------ | :------------------------------------------------- | 68 | | pin | 1234 | The 4 digit PIN used to activate Speed Limit Mode. | 69 | 70 | ### Response 71 | 72 | ```json 73 | { 74 | "reason": "", 75 | "result": true 76 | } 77 | ``` 78 | -------------------------------------------------------------------------------- /docs/vehicle/commands/sunroof.md: -------------------------------------------------------------------------------- 1 | # Sunroof 2 | 3 | ## POST `/api/1/vehicles/{id}/command/sun_roof_control` 4 | 5 | Controls the panoramic sunroof on the Model S. 6 | 7 | Note: There were state options for `open` (100%), `comfort` (~80%), and `move` (combined with a `percent` parameter), but they have since been disabled server side. It is unknown if they will return at a later time. 8 | 9 | ### Parameters 10 | 11 | | Parameter | Example | Description | 12 | | :-------- | :------ | :---------------------------------------------------------------------------------------- | 13 | | state | vent | The amount to open the sunroof. Currently this only allows the values `vent` and `close`. | 14 | 15 | ### Response 16 | 17 | ```json 18 | { 19 | "reason": "", 20 | "result": true 21 | } 22 | ``` 23 | -------------------------------------------------------------------------------- /docs/vehicle/commands/trunk.md: -------------------------------------------------------------------------------- 1 | # Frunk/Trunk 2 | 3 | ## POST `/api/1/vehicles/{id}/command/actuate_trunk` 4 | 5 | Opens either the front or rear trunk. On the Model S and X, it will also close the rear trunk. 6 | 7 | ### Parameters 8 | 9 | | Parameter | Example | Description | 10 | | :---------- | :------ | :------------------------------------------------------------------ | 11 | | which_trunk | rear | Which trunk to open/close. `rear` and `front` are the only options. | 12 | 13 | ### Response 14 | 15 | ```json 16 | { 17 | "reason": "", 18 | "result": true 19 | } 20 | ``` 21 | -------------------------------------------------------------------------------- /docs/vehicle/commands/valet.md: -------------------------------------------------------------------------------- 1 | # Valet Mode 2 | 3 | Valet Mode limits the car's top speed to 70MPH and 80kW of acceleration power. It also disables Homelink, Bluetooth and 4 | Wifi settings, and the ability to disable mobile access to the car. It also hides your favorites, home, and work 5 | locations in navigation. 6 | 7 | Note: the `password` parameter isn't required to turn on or off Valet Mode, even with a previous PIN set. If you clear the PIN and activate Valet Mode without the parameter, you will only be able to deactivate it from your car's screen by signing into your Tesla account. 8 | 9 | ## POST `/api/1/vehicles/{id}/command/set_valet_mode` 10 | 11 | Activates or deactivates Valet Mode. 12 | 13 | ### Parameters 14 | 15 | | Parameter | Example | Description | 16 | | :-------- | :------ | :------------------------------------------------------------------------------ | 17 | | on | true | true to activate, false to deactivate. | 18 | | password | 1234 | A PIN to deactivate Valet Mode. Please see note about the `password` parameter. | 19 | 20 | ### Response 21 | 22 | ```json 23 | { 24 | "reason": "", 25 | "result": true 26 | } 27 | ``` 28 | 29 | ## POST `/api/1/vehicles/{id}/command/reset_valet_pin` 30 | 31 | Clears the currently set PIN for Valet Mode when deactivated. A new PIN will be required when activating from the car screen. See the note above about activating via the API without a PIN set. 32 | 33 | ### Response 34 | 35 | ```json 36 | { 37 | "reason": "", 38 | "result": true 39 | } 40 | ``` 41 | -------------------------------------------------------------------------------- /docs/vehicle/commands/wake.md: -------------------------------------------------------------------------------- 1 | # Wake 2 | 3 | ## POST `/api/1/vehicles/{id}/wake_up` 4 | 5 | Wakes up the car from a sleeping state. 6 | 7 | The API will return a response immediately, however it could take several seconds before the car is actually online and ready to receive other commands. 8 | One way to deal with this is to call this endpoint in a loop until the returned state says "online", with a timeout to give up. In some cases, the wake up can be slow, so consider using a timeout of atleast 30 seconds. 9 | 10 | ### Response 11 | 12 | ```json 13 | { 14 | "response": { 15 | "id": 12345678901234567, 16 | "user_id": 12345, 17 | "vehicle_id": 1234567890, 18 | "vin": "5YJSA11111111111", 19 | "display_name": "Nikola 2.0", 20 | "color": null, 21 | "tokens": ["abcdef1234567890", "1234567890abcdef"], 22 | "state": "online", 23 | "in_service": false, 24 | "id_s": "12345678901234567", 25 | "calendar_enabled": true, 26 | "api_version": 7, 27 | "backseat_token": null, 28 | "backseat_token_updated_at": null 29 | } 30 | } 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/vehicle/commands/windows.md: -------------------------------------------------------------------------------- 1 | # Windows 2 | 3 | ## POST `/api/1/vehicles/{id}/command/window_control` 4 | 5 | Controls the windows. Will vent or close all windows simultaneously. 6 | 7 | `lat` and `lon` values must be near the current location of the car for 8 | `close` operation to succeed. For `vent`, the `lat` and `lon` values are 9 | ignored, and may both be `0` (which has been observed from the app itself). 10 | 11 | ### Parameters 12 | 13 | | Parameter | Example | Description | 14 | | :-------- | :------ | :-------------------------------------------------------------------------- | 15 | | command | close | What action to take with the windows. Allows the values `vent` and `close`. | 16 | | lat | 0 | Your current latitude. See Notes above. | 17 | | lon | 0 | Your current longitude. See Notes above. | 18 | 19 | ### Response 20 | 21 | ```json 22 | { 23 | "reason": "", 24 | "result": true 25 | } 26 | ``` 27 | -------------------------------------------------------------------------------- /docs/vehicle/state/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: These endpoints give the state of the various subsystems of the car. 3 | --- 4 | 5 | # State 6 | 7 | {% page-ref page="data.md" %} 8 | 9 | {% hint style='warning' %} 10 | All `data_request` endpoints have been deprecated in favor of the `vehicle_data` endpoint. All of the data they return is found in the response of `vehicle_data` within sub-categories and the documentation of these/what the different fields mean, still applies. 11 | {% endhint %} 12 | 13 | A rollup of all the `data_request` endpoints plus vehicle configuration. 14 | 15 | {% page-ref page="chargestate.md" %} 16 | 17 | Information on the state of charge in the battery and its various settings. 18 | 19 | {% page-ref page="climatestate.md" %} 20 | 21 | Information on the current internal temperature and climate control system. 22 | 23 | {% page-ref page="drivestate.md" %} 24 | 25 | Returns the driving and position state of the vehicle. 26 | 27 | {% page-ref page="guisettings.md" %} 28 | 29 | Returns various information about the GUI settings of the car, such as unit format and range display. 30 | 31 | {% page-ref page="vehiclestate.md" %} 32 | 33 | Returns the vehicle's physical state, such as which doors are open. 34 | 35 | {% page-ref page="vehicleconfig.md" %} 36 | 37 | Returns the vehicle's configuration information including model, color, badging and wheels. 38 | 39 | {% page-ref page="mobileenabled.md" %} 40 | 41 | Lets you know if the Mobile Access setting is enabled in the car. 42 | 43 | {% page-ref page="nearbychargingsites.md" %} 44 | 45 | Returns a list of nearby Tesla-operated charging stations. 46 | 47 | {% page-ref page="misc.md" %} 48 | 49 | Other miscellaneous data 50 | -------------------------------------------------------------------------------- /docs/vehicle/state/chargestate.md: -------------------------------------------------------------------------------- 1 | # Charge State 2 | 3 | {% hint style='warning' %} 4 | This endpoint was deprecated and returns 404. 5 | {% endhint %} 6 | 7 | ## GET `/api/1/vehicles/{id}/data_request/charge_state` 8 | 9 | Information on the state of charge in the battery and its various settings. 10 | 11 | ### Response 12 | 13 | ```json 14 | { 15 | "response": { 16 | "battery_heater_on": false, 17 | "battery_level": 90, 18 | "battery_range": 224.47, 19 | "charge_amps": 12, 20 | "charge_current_request": 40, 21 | "charge_current_request_max": 40, 22 | "charge_enable_request": true, 23 | "charge_energy_added": 29.41, 24 | "charge_limit_soc": 90, 25 | "charge_limit_soc_max": 100, 26 | "charge_limit_soc_min": 50, 27 | "charge_limit_soc_std": 90, 28 | "charge_miles_added_ideal": 118.5, 29 | "charge_miles_added_rated": 95.0, 30 | "charge_port_cold_weather_mode": null, 31 | "charge_port_color": "", 32 | "charge_port_door_open": true, 33 | "charge_port_latch": "Engaged", 34 | "charge_rate": 0.0, 35 | "charge_to_max_range": false, 36 | "charger_actual_current": 0, 37 | "charger_phases": null, 38 | "charger_pilot_current": 40, 39 | "charger_power": 0, 40 | "charger_voltage": 0, 41 | "charging_state": "Complete", 42 | "conn_charge_cable": "SAE", 43 | "est_battery_range": 171.24, 44 | "fast_charger_brand": "", 45 | "fast_charger_present": false, 46 | "fast_charger_type": "", 47 | "ideal_battery_range": 280.59, 48 | "managed_charging_active": false, 49 | "managed_charging_start_time": null, 50 | "managed_charging_user_canceled": false, 51 | "max_range_charge_counter": 0, 52 | "minutes_to_full_charge": 0, 53 | "not_enough_power_to_heat": false, 54 | "off_peak_charging_enabled": false, 55 | "off_peak_charging_times": "all_week", 56 | "off_peak_hours_end_time": 360, 57 | "preconditioning_enabled": false, 58 | "preconditioning_times": "all_week", 59 | "scheduled_charging_mode": "Off", 60 | "scheduled_charging_pending": false, 61 | "scheduled_charging_start_time": null, 62 | "scheduled_charging_start_time_app": 665, 63 | "scheduled_departure_time": 1652090400, 64 | "scheduled_departure_time_minutes": 720, 65 | "supercharger_session_trip_planner": false, 66 | "time_to_full_charge": 0.0, 67 | "timestamp": 1604977209418, 68 | "trip_charging": false, 69 | "usable_battery_level": 90, 70 | "user_charge_enable_request": null 71 | } 72 | } 73 | ``` 74 | -------------------------------------------------------------------------------- /docs/vehicle/state/climatestate.md: -------------------------------------------------------------------------------- 1 | # Climate State 2 | 3 | {% hint style='warning' %} 4 | This endpoint was deprecated and returns 404. 5 | {% endhint %} 6 | 7 | ## GET `/api/1/vehicles/{id}/data_request/climate_state` 8 | 9 | Information on the current internal temperature and climate control system. 10 | 11 | ### Response 12 | 13 | ```json 14 | { 15 | "response": { 16 | "allow_cabin_overheat_protection": true, 17 | "auto_seat_climate_left": true, 18 | "auto_seat_climate_right": false, 19 | "battery_heater": false, 20 | "battery_heater_no_power": false, 21 | "cabin_overheat_protection": "FanOnly", 22 | "cabin_overheat_protection_actively_cooling": false, 23 | "climate_keeper_mode": "off", 24 | "cop_activation_temperature": "High", 25 | "defrost_mode": 0, 26 | "driver_temp_setting": 22.8, 27 | "fan_status": 0, 28 | "hvac_auto_request": "On", 29 | "inside_temp": 27.0, 30 | "is_auto_conditioning_on": false, 31 | "is_climate_on": false, 32 | "is_front_defroster_on": false, 33 | "is_preconditioning": false, 34 | "is_rear_defroster_on": false, 35 | "left_temp_direction": -232, 36 | "max_avail_temp": 28.0, 37 | "min_avail_temp": 15.0, 38 | "outside_temp": 23.0, 39 | "passenger_temp_setting": 22.8, 40 | "remote_heater_control_enabled": false, 41 | "right_temp_direction": -232, 42 | "seat_heater_left": 0, 43 | "seat_heater_right": 0, 44 | "side_mirror_heaters": false, 45 | "supports_fan_only_cabin_overheat_protection": true, 46 | "timestamp": 1604977244530, 47 | "wiper_blade_heater": false 48 | } 49 | } 50 | ``` 51 | -------------------------------------------------------------------------------- /docs/vehicle/state/drivestate.md: -------------------------------------------------------------------------------- 1 | # Drive State 2 | 3 | {% hint style='warning' %} 4 | This endpoint was deprecated and returns 404. 5 | {% endhint %} 6 | 7 | ## GET `/api/1/vehicles/{id}/data_request/drive_state` 8 | 9 | Returns the driving and position state of the vehicle. 10 | 11 | ### Response 12 | 13 | ```json 14 | { 15 | "response": { 16 | "gps_as_of": 1543187664, 17 | "heading": 8, 18 | "latitude": 33.111111, 19 | "longitude": -88.111111, 20 | "native_latitude": 33.111111, 21 | "native_location_supported": 1, 22 | "native_longitude": -88.111111, 23 | "native_type": "wgs", 24 | "power": 0, 25 | "shift_state": null, 26 | "speed": null, 27 | "timestamp": 1543187666472 28 | } 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/vehicle/state/guisettings.md: -------------------------------------------------------------------------------- 1 | # GUI Settings 2 | 3 | {% hint style='warning' %} 4 | This endpoint was deprecated and returns 404. 5 | {% endhint %} 6 | 7 | ## GET `/api/1/vehicles/{id}/data_request/gui_settings` 8 | 9 | Returns various information about the GUI settings of the car, such as unit format and range display. 10 | 11 | ### Response 12 | 13 | ```json 14 | { 15 | "response": { 16 | "gui_24_hour_time": false, 17 | "gui_charge_rate_units": "mi/hr", 18 | "gui_distance_units": "mi/hr", 19 | "gui_range_display": "Rated", 20 | "gui_temperature_units": "F", 21 | "show_range_units": true, 22 | "timestamp": 1543187561462 23 | } 24 | } 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/vehicle/state/misc.md: -------------------------------------------------------------------------------- 1 | # Miscellaneous Vehicle Data 2 | 3 | ## GET `/api/1/vehicles/{vehicle_id}/release_notes` 4 | 5 | Get the current software version or upcoming software update's release notes. 6 | 7 | ### Parameters 8 | 9 | | Parameter | Example | Description | 10 | | :-------- | :------ | :-------------------------------------------------------------------------------------------------------------- | 11 | | staged | true | If there is currently a pending software update, this will return the upcoming software update's release notes. | 12 | 13 | ### Response 14 | 15 | ```json 16 | { 17 | "response": { 18 | "release_notes": [ 19 | { 20 | "title": "Feature 1", 21 | "subtitle": "A bit more info", 22 | "description": "What changed?", 23 | "customer_version": "2022.40", 24 | "image_url": "https://vehicle-files.teslamotors.com/release_notes/{id}?__gda__=exp={unix_timestamp}~acl=/release_notes/{id}~hmac={id}" 25 | } 26 | ], 27 | "deployed_version": "2022.40.4.2", 28 | "staged_version": null 29 | } 30 | } 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/vehicle/state/mobileenabled.md: -------------------------------------------------------------------------------- 1 | # Mobile Enabled 2 | 3 | ## GET `/api/1/vehicles/{id}/mobile_enabled` 4 | 5 | Lets you know if the Mobile Access setting is enabled in the car. 6 | 7 | ### Response 8 | 9 | ```json 10 | { 11 | "response": true 12 | } 13 | ``` 14 | -------------------------------------------------------------------------------- /docs/vehicle/state/nearbychargingsites.md: -------------------------------------------------------------------------------- 1 | # Nearby Charging Sites 2 | 3 | ## GET `/api/1/vehicles/{id}/nearby_charging_sites` 4 | 5 | Returns a list of nearby Tesla-operated charging stations. (Requires car software version 2018.48 or higher.) 6 | 7 | ### Response 8 | 9 | ```json 10 | { 11 | "response": { 12 | "congestion_sync_time_utc_secs": 1604976488, 13 | "destination_charging": [ 14 | { 15 | "location": { "lat": 34.010854, "long": -84.574979 }, 16 | "name": "Hilton Garden Inn Atlanta NW/Kennesaw Town Center", 17 | "type": "destination", 18 | "distance_miles": 6.430447 19 | }, 20 | { 21 | "location": { "lat": 34.011213, "long": -84.575745 }, 22 | "name": "Homewood Suites by Hilton Atlanta NW-Kennesaw", 23 | "type": "destination", 24 | "distance_miles": 6.48008 25 | }, 26 | { 27 | "location": { "lat": 33.881785, "long": -84.473461 }, 28 | "name": "Hyatt Place Atlanta/Cobb Galleria", 29 | "type": "destination", 30 | "distance_miles": 6.778101 31 | }, 32 | { 33 | "location": { "lat": 33.991767, "long": -84.351229 }, 34 | "name": "European Collision Repair", 35 | "type": "destination", 36 | "distance_miles": 6.805893 37 | } 38 | ], 39 | "superchargers": [ 40 | { 41 | "location": { "lat": 33.848756, "long": -84.36434 }, 42 | "name": "Atlanta, GA - Peachtree Road", 43 | "type": "supercharger", 44 | "distance_miles": 10.868304, 45 | "available_stalls": 4, 46 | "total_stalls": 5, 47 | "site_closed": false 48 | }, 49 | { 50 | "location": { "lat": 33.846487, "long": -84.360172 }, 51 | "name": "Atlanta, GA - Lenox Road", 52 | "type": "supercharger", 53 | "distance_miles": 11.131691, 54 | "available_stalls": 16, 55 | "total_stalls": 16, 56 | "site_closed": false 57 | }, 58 | { 59 | "location": { "lat": 34.075818, "long": -84.652184 }, 60 | "name": "Acworth, GA", 61 | "type": "supercharger", 62 | "distance_miles": 12.403464, 63 | "available_stalls": 11, 64 | "total_stalls": 11, 65 | "site_closed": false 66 | }, 67 | { 68 | "location": { "lat": 34.071365, "long": -84.275362 }, 69 | "name": "Alpharetta, GA", 70 | "type": "supercharger", 71 | "distance_miles": 12.772961, 72 | "available_stalls": 6, 73 | "total_stalls": 10, 74 | "site_closed": false 75 | } 76 | ], 77 | "timestamp": 1604977312943 78 | } 79 | } 80 | ``` 81 | -------------------------------------------------------------------------------- /docs/vehicle/state/vehicleconfig.md: -------------------------------------------------------------------------------- 1 | # Vehicle Config 2 | 3 | {% hint style='warning' %} 4 | This endpoint was deprecated and returns 404. 5 | {% endhint %} 6 | 7 | ## GET `/api/1/vehicles/{id}/data_request/vehicle_config` 8 | 9 | Returns the vehicle's configuration information including model, color, badging and wheels. 10 | 11 | ### Response 12 | 13 | ```json 14 | { 15 | "response": { 16 | "can_accept_navigation_requests": true, 17 | "can_actuate_trunks": true, 18 | "car_special_type": "base", 19 | "car_type": "models2", 20 | "charge_port_type": "US", 21 | "ece_restrictions": false, 22 | "eu_vehicle": false, 23 | "exterior_color": "White", 24 | "has_air_suspension": true, 25 | "has_ludicrous_mode": false, 26 | "motorized_charge_port": true, 27 | "plg": true, 28 | "rear_seat_heaters": 0, 29 | "rear_seat_type": 0, 30 | "rhd": false, 31 | "roof_color": "None", 32 | "seat_type": 2, 33 | "spoiler_type": "None", 34 | "sun_roof_installed": 2, 35 | "third_row_seats": "None", 36 | "timestamp": 1604977445448, 37 | "trim_badging": "p90d", 38 | "use_range_badging": false, 39 | "wheel_type": "AeroTurbine19" 40 | } 41 | } 42 | ``` 43 | -------------------------------------------------------------------------------- /docs/vehicle/state/vehiclestate.md: -------------------------------------------------------------------------------- 1 | # Vehicle State 2 | 3 | {% hint style='warning' %} 4 | This endpoint was deprecated and returns 404. 5 | {% endhint %} 6 | 7 | ## GET `/api/1/vehicles/{id}/data_request/vehicle_state` 8 | 9 | Returns the vehicle's physical state, such as which doors are open. 10 | 11 | For the trunk (rt) and frunk (ft) fields, you should interpret a zero (0) value as closed and a non-zero value as open (partially or fully). 12 | 13 | Here are the currently known values for the `center_display_state` field: 14 | 15 | | State | Description | 16 | | ----- | ------------------------ | 17 | | 0 | Off | 18 | | 2 | On, standby or Camp Mode | 19 | | 3 | On, charging screen | 20 | | 4 | On | 21 | | 5 | On, Big charging screen | 22 | | 6 | On, Ready to unlock | 23 | | 7 | Sentry Mode | 24 | | 8 | Dog Mode | 25 | | 9 | Media | 26 | 27 | Here are the descriptions for the shorthand fields: 28 | 29 | | Field | Description | 30 | | ----- | --------------- | 31 | | df | driver front | 32 | | dr | driver rear | 33 | | pf | passenger front | 34 | | pr | passenger rear | 35 | | ft | front trunk | 36 | | rt | rear trunk | 37 | 38 | ### Response 39 | 40 | ```json 41 | { 42 | "response": { 43 | "api_version": 10, 44 | "autopark_state_v2": "standby", 45 | "autopark_style": "standard", 46 | "calendar_supported": true, 47 | "car_version": "2020.36.16 3e9e4e8dd287", 48 | "center_display_state": 0, 49 | "df": 0, 50 | "dr": 0, 51 | "ft": 0, 52 | "homelink_device_count": 2, 53 | "homelink_nearby": true, 54 | "is_user_present": false, 55 | "last_autopark_error": "no_error", 56 | "locked": false, 57 | "media_state": { "remote_control_enabled": true }, 58 | "notifications_supported": true, 59 | "odometer": 57509.856033, 60 | "parsed_calendar_supported": true, 61 | "pf": 0, 62 | "pr": 0, 63 | "remote_start": false, 64 | "remote_start_enabled": true, 65 | "remote_start_supported": true, 66 | "rt": 0, 67 | "sentry_mode": false, 68 | "sentry_mode_available": true, 69 | "smart_summon_available": true, 70 | "software_update": { 71 | "download_perc": 0, 72 | "expected_duration_sec": 2700, 73 | "install_perc": 1, 74 | "status": "", 75 | "version": "" 76 | }, 77 | "speed_limit_mode": { 78 | "active": false, 79 | "current_limit_mph": 50.0, 80 | "max_limit_mph": 90, 81 | "min_limit_mph": 50, 82 | "pin_code_set": true 83 | }, 84 | "summon_standby_mode_enabled": false, 85 | "sun_roof_percent_open": 0, 86 | "sun_roof_state": "closed", 87 | "timestamp": 1604977470379, 88 | "tpms_pressure_fl": 0.0, 89 | "tpms_pressure_fr": 0.0, 90 | "tpms_pressure_rl": 0.0, 91 | "tpms_pressure_rr": 0.0, 92 | "valet_mode": false, 93 | "valet_pin_needed": true, 94 | "vehicle_name": "Nikola 2.0" 95 | } 96 | } 97 | ``` 98 | -------------------------------------------------------------------------------- /docs/vehicle/streaming.md: -------------------------------------------------------------------------------- 1 | # Streaming 2 | 3 | Please help fill this out! https://github.com/timdorr/tesla-api/issues/97 4 | -------------------------------------------------------------------------------- /lib/tesla_api.rb: -------------------------------------------------------------------------------- 1 | require "date" 2 | require "base64" 3 | 4 | require "faraday" 5 | require "faraday_middleware" 6 | 7 | require "async" 8 | require "async/http/endpoint" 9 | require "async/websocket/client" 10 | 11 | require "tesla_api/version" 12 | require "tesla_api/client" 13 | require "tesla_api/stream" 14 | require "tesla_api/autopark" 15 | require "tesla_api/vehicle" 16 | -------------------------------------------------------------------------------- /lib/tesla_api/autopark.rb: -------------------------------------------------------------------------------- 1 | module TeslaApi 2 | module Autopark 3 | def start_autopark(&handler) 4 | Async do |task| 5 | Async::WebSocket::Client.connect(autopark_endpoint, headers: headers) do |connection| 6 | while (message = connection.read) 7 | case message[:msg_type] 8 | when "control:hello" 9 | interval = message[:autopark][:heartbeat_frequency] / 1000.0 10 | task.async do |subtask| 11 | subtask.sleep interval 12 | connection.write({msg_type: "autopark:heartbeat_app", timestamp: Time.now.to_i}.to_json) 13 | end 14 | end 15 | 16 | handler.call(message) 17 | end 18 | end 19 | end 20 | end 21 | 22 | private 23 | 24 | def autopark_endpoint 25 | Async::HTTP::Endpoint.parse(autopark_endpoint_url) 26 | end 27 | 28 | def autopark_endpoint_url 29 | "wss://streaming.vn.teslamotors.com/connect/#{self["vehicle_id"]}" 30 | end 31 | 32 | def autopark_headers 33 | { 34 | "Authorization" => "Basic #{socket_auth}" 35 | } 36 | end 37 | 38 | def autopark_socket_auth 39 | Base64.strict_encode64("#{email}:#{self["tokens"].first}") 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /lib/tesla_api/stream.rb: -------------------------------------------------------------------------------- 1 | module TeslaApi 2 | module Stream 3 | def self.streaming_endpoint_url 4 | "wss://streaming.vn.teslamotors.com/streaming/" 5 | end 6 | 7 | def self.streaming_endpoint 8 | Async::HTTP::Endpoint.parse(streaming_endpoint_url, alpn_protocols: Async::HTTP::Protocol::HTTP11.names) 9 | end 10 | 11 | def stream(endpoint: Stream.streaming_endpoint, &receiver) 12 | Async do |task| 13 | Async::WebSocket::Client.connect(endpoint) do |connection| 14 | on_timeout = ->(subtask) do 15 | subtask.sleep TIMEOUT 16 | task.stop 17 | end 18 | 19 | connection.write(streaming_connect_message) 20 | timeout = task.async(&on_timeout) 21 | 22 | while (message = connection.read) 23 | timeout.stop 24 | timeout = task.async(&on_timeout) 25 | 26 | case message[:msg_type] 27 | when "data:update" 28 | attributes = message[:value].split(",") 29 | 30 | receiver.call({ 31 | time: DateTime.strptime((attributes[0].to_i / 1000).to_s, "%s"), 32 | speed: attributes[1].to_f, 33 | odometer: attributes[2].to_f, 34 | soc: attributes[3].to_f, 35 | elevation: attributes[4].to_f, 36 | est_heading: attributes[5].to_f, 37 | est_lat: attributes[6].to_f, 38 | est_lng: attributes[7].to_f, 39 | power: attributes[8].to_f, 40 | shift_state: attributes[9].to_s, 41 | range: attributes[10].to_f, 42 | est_range: attributes[11].to_f, 43 | heading: attributes[12].to_f 44 | }) 45 | when "data:error" 46 | task.stop 47 | end 48 | end 49 | end 50 | end 51 | end 52 | 53 | private 54 | 55 | TIMEOUT = 30 56 | 57 | def streaming_connect_message 58 | { 59 | msg_type: "data:subscribe_oauth", 60 | token: client.access_token, 61 | value: "speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range,heading", 62 | tag: self["vehicle_id"].to_s 63 | } 64 | end 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /lib/tesla_api/version.rb: -------------------------------------------------------------------------------- 1 | module TeslaApi 2 | VERSION = "3.1.0" 3 | end 4 | -------------------------------------------------------------------------------- /spec/cassettes/client-refresh.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://auth.tesla.com/oauth2/v3/token 6 | body: 7 | encoding: UTF-8 8 | string: '{"grant_type":"refresh_token","scope":"openid email offline_access","client_id":"ownerapi","client_secret":"","refresh_token":""}' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.7 12 | Content-Type: 13 | - application/json 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - '*/*' 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Content-Type: 26 | - application/json 27 | X-Dns-Prefetch-Control: 28 | - 'off' 29 | X-Frame-Options: 30 | - DENY 31 | Strict-Transport-Security: 32 | - max-age=15552000; includeSubDomains 33 | X-Download-Options: 34 | - noopen 35 | X-Content-Type-Options: 36 | - nosniff 37 | X-Xss-Protection: 38 | - 1; mode=block 39 | X-Request-Id: 40 | - c6575e47-91d3-4a07-9985-358de3dbe39e 41 | X-Correlation-Id: 42 | - c6575e47-91d3-4a07-9985-358de3dbe39e 43 | Cache-Control: 44 | - no-store 45 | Pragma: 46 | - no-cache 47 | X-Response-Time: 48 | - 24.639ms 49 | Date: 50 | - Sat, 30 Jan 2021 15:18:43 GMT 51 | Content-Length: 52 | - '2517' 53 | Connection: 54 | - keep-alive 55 | body: 56 | encoding: UTF-8 57 | string: '{"access_token":"acess","refresh_token":"","id_token":"id","expires_in":28800,"token_type":"Bearer"}' 58 | recorded_at: Sat, 30 Jan 2021 15:18:43 GMT 59 | recorded_with: VCR 6.0.0 60 | -------------------------------------------------------------------------------- /spec/cassettes/client-vehicles.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 53514fcfea416c9dd77b50d0a1c1dc681960002d23c22b1a9cf2681e8cbec8da 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Mon, 15 Dec 2014 03:28:30 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '446' 25 | Connection: 26 | - keep-alive 27 | Status: 28 | - 200 OK 29 | X-Ua-Compatible: 30 | - IE=Edge,chrome=1 31 | Etag: 32 | - '"4a35974adbecef7554d775e098548913"' 33 | Cache-Control: 34 | - max-age=0, private, must-revalidate 35 | X-Request-Id: 36 | - 59523c1d2611a93fa82e277ae4d97e87 37 | X-Runtime: 38 | - '0.289093' 39 | body: 40 | encoding: UTF-8 41 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["74bd32f47d3c8d9e","c244a90fbad06a65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 42 | http_version: 43 | recorded_at: Mon, 15 Dec 2014 03:28:30 GMT 44 | recorded_with: VCR 2.9.3 45 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-activate_speed_limit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Wed, 18 Jul 2018 23:51:08 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '623' 25 | Connection: 26 | - keep-alive 27 | X-Frame-Options: 28 | - SAMEORIGIN 29 | - SAMEORIGIN 30 | X-Xss-Protection: 31 | - 1; mode=block 32 | X-Content-Type-Options: 33 | - nosniff 34 | X-Txid: 35 | - 847e4b8523b39310a4586d423f030546 36 | Etag: 37 | - W/"6958697e3e1e010f56068d8c7fa2f93d" 38 | Cache-Control: 39 | - max-age=0, private, must-revalidate 40 | X-Request-Id: 41 | - 435b45f8-45d1-4c08-b436-4d403d369d8d 42 | X-Runtime: 43 | - '0.046828' 44 | body: 45 | encoding: UTF-8 46 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 47 | http_version: 48 | recorded_at: Wed, 18 Jul 2018 23:51:08 GMT 49 | - request: 50 | method: post 51 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/speed_limit_activate 52 | body: 53 | encoding: UTF-8 54 | string: pin=1234 55 | headers: 56 | Authorization: 57 | - Bearer 58 | response: 59 | status: 60 | code: 200 61 | message: OK 62 | headers: 63 | Server: 64 | - nginx 65 | Date: 66 | - Wed, 18 Jul 2018 23:51:09 GMT 67 | Content-Type: 68 | - application/json; charset=utf-8 69 | Content-Length: 70 | - '40' 71 | Connection: 72 | - keep-alive 73 | X-Frame-Options: 74 | - SAMEORIGIN 75 | - SAMEORIGIN 76 | X-Xss-Protection: 77 | - 1; mode=block 78 | X-Content-Type-Options: 79 | - nosniff 80 | X-Txid: 81 | - be21a3dafb36eb974f6bbdc8c93a20f2 82 | Etag: 83 | - W/"f67eec105dd6522783a1f1bacc52723a" 84 | Cache-Control: 85 | - max-age=0, private, must-revalidate 86 | X-Request-Id: 87 | - 6595159d-7cd5-4838-9d08-e4bebeb98944 88 | X-Runtime: 89 | - '0.113766' 90 | body: 91 | encoding: UTF-8 92 | string: '{"response":{"reason":"","result":true}}' 93 | http_version: 94 | recorded_at: Wed, 18 Jul 2018 23:51:09 GMT 95 | recorded_with: VCR 3.0.3 96 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-auto_conditioning_start.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:33:41 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - c31149ebc7a02e58d94888f526dca0d8 41 | X-Runtime: 42 | - '0.473320' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"41ed8ed293b2e0395bf66b01defa47a1790aed0c2d90bda4e0dd40ff30179a04","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:33:43 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 41ed8ed293b2e0395bf66b01defa47a1790aed0c2d90bda4e0dd40ff30179a04 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:33:42 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"c52908b8db9336f89e7a1602f3b2a458"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - a5a3c0ba87ff5ed57d362aad496385eb 82 | X-Runtime: 83 | - '0.172755' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["b1278e37b13e8df2","b2fd1ad42f706a73"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:33:43 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/auto_conditioning_start 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 41ed8ed293b2e0395bf66b01defa47a1790aed0c2d90bda4e0dd40ff30179a04 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:33:43 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 6cf21f267374ed099b71ab979bfd1e10 123 | X-Runtime: 124 | - '1.191736' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:33:45 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-auto_conditioning_stop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:34:18 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - db0fbf30042251a5b7b3bf1d491ab307 41 | X-Runtime: 42 | - '0.602222' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"ba268ba8e0726ad1776918965e54235a5ce2cc569910756bc07fec91b1702ffd","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:34:19 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer ba268ba8e0726ad1776918965e54235a5ce2cc569910756bc07fec91b1702ffd 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:34:18 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"c52908b8db9336f89e7a1602f3b2a458"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 64c473cf9e85a63c43278b19e1d38789 82 | X-Runtime: 83 | - '0.051722' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["b1278e37b13e8df2","b2fd1ad42f706a73"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:34:20 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/auto_conditioning_stop 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer ba268ba8e0726ad1776918965e54235a5ce2cc569910756bc07fec91b1702ffd 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:34:19 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 2a0bbf78f050ad15967dcd68d73d81c6 123 | X-Runtime: 124 | - '0.227709' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:34:21 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-cancel_software_update.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.3.0 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Tue, 11 Dec 2018 03:59:06 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '659' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - 27955654740d1c78c3a1443113ad7fb3 38 | Etag: 39 | - W/"0d85a34aa9e150f718d20dc8c7a68fb1" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - 96720096-cff6-4af3-bacb-f9731e8db0b5 44 | X-Runtime: 45 | - '0.042320' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["08f5098517a10231","8d219a2e09242e02"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Tue, 11 Dec 2018 03:59:06 GMT 52 | - request: 53 | method: post 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/cancel_software_update 55 | body: 56 | encoding: UTF-8 57 | string: '' 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.3.0 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Tue, 11 Dec 2018 03:59:07 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '40' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | - SAMEORIGIN 81 | X-Xss-Protection: 82 | - 1; mode=block 83 | X-Content-Type-Options: 84 | - nosniff 85 | X-Txid: 86 | - 637d5862f7a5bd11bfdd7521fde3d607 87 | Etag: 88 | - W/"f67eec105dd6522783a1f1bacc52723a" 89 | Cache-Control: 90 | - max-age=0, private, must-revalidate 91 | X-Request-Id: 92 | - 628f2e19-3def-4bda-afd4-beb8859a734f 93 | X-Runtime: 94 | - '0.394726' 95 | body: 96 | encoding: UTF-8 97 | string: '{"response":{"reason":"","result":true}}' 98 | http_version: 99 | recorded_at: Tue, 11 Dec 2018 03:59:07 GMT 100 | recorded_with: VCR 4.0.0 101 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-charge_max_range.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 00:55:06 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - 90a0b4739059139b6e1264fdf58e68ac 41 | X-Runtime: 42 | - '0.481155' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"9ac91bab16357dba7079b6658892194d0e3e0451bf9473028934cd33ca3630b9","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 00:55:08 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 9ac91bab16357dba7079b6658892194d0e3e0451bf9473028934cd33ca3630b9 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 00:55:07 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"92bf165299826af7b9ed0b8f3886e15e"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 7cd715f8ee9de502436575e911f972d1 82 | X-Runtime: 83 | - '0.044155' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["91a139ce322eed65","493cead2e5ab6535"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 00:55:08 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/charge_max_range 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 9ac91bab16357dba7079b6658892194d0e3e0451bf9473028934cd33ca3630b9 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 00:55:07 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '58' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"166ceb8e24f75b4a416e51ce669070f3"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - d5dd07abb1535258e6c234cb892cc4f0 123 | X-Runtime: 124 | - '0.199652' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 00:55:09 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-charge_port_door_close.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.3.0 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Tue, 11 Dec 2018 03:44:57 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '659' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - 15cb55dec7d2d1dc78cd67598aa706f6 38 | Etag: 39 | - W/"b26b5170c82c57684330e746935a0a44" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - 4c97b069-a150-4e57-a26f-429af72c15d7 44 | X-Runtime: 45 | - '0.018406' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["8d219a2e09242e02","b12ead7cd34f97da"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Tue, 11 Dec 2018 03:44:57 GMT 52 | - request: 53 | method: post 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/charge_port_door_close 55 | body: 56 | encoding: UTF-8 57 | string: '' 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.3.0 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Tue, 11 Dec 2018 03:44:57 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '40' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | - SAMEORIGIN 81 | X-Xss-Protection: 82 | - 1; mode=block 83 | X-Content-Type-Options: 84 | - nosniff 85 | X-Txid: 86 | - c09dc914f843986f904fd37003063934 87 | Etag: 88 | - W/"f67eec105dd6522783a1f1bacc52723a" 89 | Cache-Control: 90 | - max-age=0, private, must-revalidate 91 | X-Request-Id: 92 | - 3e178497-b115-450c-9c89-602dc7e5a505 93 | X-Runtime: 94 | - '0.214039' 95 | body: 96 | encoding: UTF-8 97 | string: '{"response":{"reason":"","result":true}}' 98 | http_version: 99 | recorded_at: Tue, 11 Dec 2018 03:44:57 GMT 100 | recorded_with: VCR 4.0.0 101 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-charge_port_door_open.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 00:47:00 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - 66bfe4aab391f4ab72df78795785a865 41 | X-Runtime: 42 | - '0.529000' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"e165f77b43f067c42311f3a73099dede89d55cfc81d5b78fca80607e9edabb60","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 00:47:02 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer e165f77b43f067c42311f3a73099dede89d55cfc81d5b78fca80607e9edabb60 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 00:47:01 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"92bf165299826af7b9ed0b8f3886e15e"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - e08fcebe67e880a9579e80bd95e42fe7 82 | X-Runtime: 83 | - '0.113711' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["91a139ce322eed65","493cead2e5ab6535"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 00:47:03 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/charge_port_door_open 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer e165f77b43f067c42311f3a73099dede89d55cfc81d5b78fca80607e9edabb60 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 00:47:02 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 5b50e5e2654e8d4d2a8071f23a8ea597 123 | X-Runtime: 124 | - '1.011086' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 00:47:04 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-charge_standard.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 00:52:08 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - 649a55686f322915de23a9f4636e2043 41 | X-Runtime: 42 | - '0.629557' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"66791062df168aa8e7d0d367e95713e7b5eb4b01a4be2852399616454d845b27","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 00:52:10 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 66791062df168aa8e7d0d367e95713e7b5eb4b01a4be2852399616454d845b27 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 00:52:08 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"92bf165299826af7b9ed0b8f3886e15e"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 8358c119ad64878299f3a8710e49501d 82 | X-Runtime: 83 | - '0.157850' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["91a139ce322eed65","493cead2e5ab6535"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 00:52:10 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/charge_standard 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 66791062df168aa8e7d0d367e95713e7b5eb4b01a4be2852399616454d845b27 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 00:52:09 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 9a9acc36ef6ccfec21b697cc65f09a52 123 | X-Runtime: 124 | - '0.240221' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 00:52:11 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-charge_start.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:02:59 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - e958194a4359716e2882e8c49831a696 41 | X-Runtime: 42 | - '0.447073' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"71591bda266087e20470fe02f8f2fda1ca8da6b18ab1c1a28f9f3d4ef3d6bf11","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:03:01 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 71591bda266087e20470fe02f8f2fda1ca8da6b18ab1c1a28f9f3d4ef3d6bf11 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:03:00 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"900c699a9c4c6d36d87b1902a2fda748"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 0a5cb286b559a55a6fd7f50bd0199e7c 82 | X-Runtime: 83 | - '0.105899' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:03:02 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/charge_start 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 71591bda266087e20470fe02f8f2fda1ca8da6b18ab1c1a28f9f3d4ef3d6bf11 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:03:00 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 66d8a87dc19ed590a30fe5036ca973bc 123 | X-Runtime: 124 | - '0.232926' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:03:02 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-charge_stop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:03:36 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - dec86095897416efc871bb0963f6af55 41 | X-Runtime: 42 | - '0.410416' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"55bb0930594ab9488513ac0fb3b4b9b1ee3ed749ee39520f7d53fa59c96d7fd9","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:03:38 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 55bb0930594ab9488513ac0fb3b4b9b1ee3ed749ee39520f7d53fa59c96d7fd9 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:03:37 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"900c699a9c4c6d36d87b1902a2fda748"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 5931934aa88b37a81731e7e8ebfd4c48 82 | X-Runtime: 83 | - '0.061113' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:03:39 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/charge_stop 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 55bb0930594ab9488513ac0fb3b4b9b1ee3ed749ee39520f7d53fa59c96d7fd9 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:03:38 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - bb8c6db86172e67855fb1685628aa49c 123 | X-Runtime: 124 | - '0.255981' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:03:39 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-clear_speed_limit_pin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Wed, 18 Jul 2018 23:51:23 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '623' 25 | Connection: 26 | - keep-alive 27 | X-Frame-Options: 28 | - SAMEORIGIN 29 | - SAMEORIGIN 30 | X-Xss-Protection: 31 | - 1; mode=block 32 | X-Content-Type-Options: 33 | - nosniff 34 | X-Txid: 35 | - bc80be5384634b6dc8c0a299b989d27d 36 | Etag: 37 | - W/"6958697e3e1e010f56068d8c7fa2f93d" 38 | Cache-Control: 39 | - max-age=0, private, must-revalidate 40 | X-Request-Id: 41 | - fa8c5085-118f-43f1-888c-5a809d611db3 42 | X-Runtime: 43 | - '0.022783' 44 | body: 45 | encoding: UTF-8 46 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 47 | http_version: 48 | recorded_at: Wed, 18 Jul 2018 23:51:23 GMT 49 | - request: 50 | method: post 51 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/speed_limit_clear_pin 52 | body: 53 | encoding: UTF-8 54 | string: pin=1234 55 | headers: 56 | Authorization: 57 | - Bearer 58 | response: 59 | status: 60 | code: 200 61 | message: OK 62 | headers: 63 | Server: 64 | - nginx 65 | Date: 66 | - Wed, 18 Jul 2018 23:51:23 GMT 67 | Content-Type: 68 | - application/json; charset=utf-8 69 | Content-Length: 70 | - '40' 71 | Connection: 72 | - keep-alive 73 | X-Frame-Options: 74 | - SAMEORIGIN 75 | - SAMEORIGIN 76 | X-Xss-Protection: 77 | - 1; mode=block 78 | X-Content-Type-Options: 79 | - nosniff 80 | X-Txid: 81 | - 0d08fce559d8e65c3f2af0f17c81cdc5 82 | Etag: 83 | - W/"f67eec105dd6522783a1f1bacc52723a" 84 | Cache-Control: 85 | - max-age=0, private, must-revalidate 86 | X-Request-Id: 87 | - c3ef68ab-513e-4d42-8db6-c16bdb953a04 88 | X-Runtime: 89 | - '0.114087' 90 | body: 91 | encoding: UTF-8 92 | string: '{"response":{"reason":"","result":true}}' 93 | http_version: 94 | recorded_at: Wed, 18 Jul 2018 23:51:23 GMT 95 | recorded_with: VCR 3.0.3 96 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-deactivate_speed_limit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Wed, 18 Jul 2018 23:51:14 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '623' 25 | Connection: 26 | - keep-alive 27 | X-Frame-Options: 28 | - SAMEORIGIN 29 | - SAMEORIGIN 30 | X-Xss-Protection: 31 | - 1; mode=block 32 | X-Content-Type-Options: 33 | - nosniff 34 | X-Txid: 35 | - 05b9838c6520dc434f4ff30372560b1b 36 | Etag: 37 | - W/"6958697e3e1e010f56068d8c7fa2f93d" 38 | Cache-Control: 39 | - max-age=0, private, must-revalidate 40 | X-Request-Id: 41 | - f09cc4df-b6df-42f2-9363-2c20fb970f9d 42 | X-Runtime: 43 | - '0.017357' 44 | body: 45 | encoding: UTF-8 46 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 47 | http_version: 48 | recorded_at: Wed, 18 Jul 2018 23:51:14 GMT 49 | - request: 50 | method: post 51 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/speed_limit_deactivate 52 | body: 53 | encoding: UTF-8 54 | string: pin=1234 55 | headers: 56 | Authorization: 57 | - Bearer 58 | response: 59 | status: 60 | code: 200 61 | message: OK 62 | headers: 63 | Server: 64 | - nginx 65 | Date: 66 | - Wed, 18 Jul 2018 23:51:14 GMT 67 | Content-Type: 68 | - application/json; charset=utf-8 69 | Content-Length: 70 | - '40' 71 | Connection: 72 | - keep-alive 73 | X-Frame-Options: 74 | - SAMEORIGIN 75 | - SAMEORIGIN 76 | X-Xss-Protection: 77 | - 1; mode=block 78 | X-Content-Type-Options: 79 | - nosniff 80 | X-Txid: 81 | - d97b96421307d17836b61e70f9ff33e6 82 | Etag: 83 | - W/"f67eec105dd6522783a1f1bacc52723a" 84 | Cache-Control: 85 | - max-age=0, private, must-revalidate 86 | X-Request-Id: 87 | - bd64baaf-2dd9-414e-b3ca-46db9f5eaddd 88 | X-Runtime: 89 | - '0.145679' 90 | body: 91 | encoding: UTF-8 92 | string: '{"response":{"reason":"","result":true}}' 93 | http_version: 94 | recorded_at: Wed, 18 Jul 2018 23:51:14 GMT 95 | recorded_with: VCR 3.0.3 96 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-door_lock.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:06:04 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - d4d3206c0e5c38dfe3e8a8c05e353d3d 41 | X-Runtime: 42 | - '0.358326' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"3be1e79c3e7541a9ed1137b9baf719f3b07aab5966b49d7c42b004f1cb909005","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:06:06 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 3be1e79c3e7541a9ed1137b9baf719f3b07aab5966b49d7c42b004f1cb909005 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:06:05 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"900c699a9c4c6d36d87b1902a2fda748"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - b321242c88b0d31fc952ec46ca2816ab 82 | X-Runtime: 83 | - '0.457357' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:06:07 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/door_lock 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 3be1e79c3e7541a9ed1137b9baf719f3b07aab5966b49d7c42b004f1cb909005 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:06:06 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 6dc4f32386cfa0a6d3e8a6a06849572e 123 | X-Runtime: 124 | - '0.226051' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:06:07 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-door_unlock.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:06:00 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - a8173dfef1131b5cec6e95f121264c3d 41 | X-Runtime: 42 | - '0.472700' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"421c74dc2b7b4705b57384a0c119b31eb08964b0029178b0f3b6a995855ac403","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:06:02 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 421c74dc2b7b4705b57384a0c119b31eb08964b0029178b0f3b6a995855ac403 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:06:01 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"900c699a9c4c6d36d87b1902a2fda748"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 80cf21df47a20d4c5124ed6cf73f0480 82 | X-Runtime: 83 | - '0.061293' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:06:02 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/door_unlock 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 421c74dc2b7b4705b57384a0c119b31eb08964b0029178b0f3b6a995855ac403 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:06:01 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - fe82543053049ea198a5b7ee40801898 123 | X-Runtime: 124 | - '0.226710' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:06:03 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-flash_lights.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:05:03 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - bad57ec5aadb2cd79ff6a050d86eb9b5 41 | X-Runtime: 42 | - '0.347671' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"52a20c2f250a12541bf54fdbad7b7d530c9c16b7eab5a49a632ce4ff92dd49ca","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:05:05 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 52a20c2f250a12541bf54fdbad7b7d530c9c16b7eab5a49a632ce4ff92dd49ca 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:05:04 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"900c699a9c4c6d36d87b1902a2fda748"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 60cc8443cdeea606ea749a11254ac938 82 | X-Runtime: 83 | - '0.049626' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:05:05 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/flash_lights 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 52a20c2f250a12541bf54fdbad7b7d530c9c16b7eab5a49a632ce4ff92dd49ca 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:05:06 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - d02448114303e2bf64d186b9f07f6e23 123 | X-Runtime: 124 | - '1.747628' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:05:07 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-honk_horn.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:05:07 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - bb65d486b56a612518f45b5388de80ab 41 | X-Runtime: 42 | - '0.533290' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"98d5ac94ea3ea2cd7eb27694d1d2575af599ef2fe823607ba316d157eebd2c8d","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:05:09 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 98d5ac94ea3ea2cd7eb27694d1d2575af599ef2fe823607ba316d157eebd2c8d 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:05:08 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"900c699a9c4c6d36d87b1902a2fda748"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 25392b92f4c74e168ba4274fd7f96ba8 82 | X-Runtime: 83 | - '0.057493' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:05:09 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/honk_horn 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 98d5ac94ea3ea2cd7eb27694d1d2575af599ef2fe823607ba316d157eebd2c8d 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:05:08 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 6ea606a5f197f644fc810917f862c63a 123 | X-Runtime: 124 | - '0.315469' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:05:10 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-media_next_fav.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Oct 2019 12:07:15 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - 14bff6e11faacd74f2e45e00ce3a22ca 42 | Etag: 43 | - W/"fee0c127f31e354aae63ac0325c6cce4" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - 1c00cd57-2b52-43f1-b179-4569cbe3cc9d 48 | X-Runtime: 49 | - '0.037398' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","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,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 53 | http_version: 54 | recorded_at: Thu, 03 Oct 2019 12:07:15 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_next_fav 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | headers: 62 | User-Agent: 63 | - github.com/timdorr/tesla-api v:3.0.1 64 | Authorization: 65 | - Bearer 66 | Content-Length: 67 | - '0' 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | Server: 78 | - nginx 79 | Date: 80 | - Thu, 03 Oct 2019 12:07:16 GMT 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Content-Length: 84 | - '40' 85 | Connection: 86 | - keep-alive 87 | X-Frame-Options: 88 | - SAMEORIGIN 89 | - SAMEORIGIN 90 | X-Xss-Protection: 91 | - 1; mode=block 92 | X-Content-Type-Options: 93 | - nosniff 94 | X-Txid: 95 | - 8071c728da780d613a3b5af7e219c080 96 | Etag: 97 | - W/"f67eec105dd6522783a1f1bacc52723a" 98 | Cache-Control: 99 | - max-age=0, private, must-revalidate 100 | X-Request-Id: 101 | - 23e04dbb-c730-4d64-949d-1f6fb5723cc8 102 | X-Runtime: 103 | - '0.535570' 104 | body: 105 | encoding: UTF-8 106 | string: '{"response":{"reason":"","result":true}}' 107 | http_version: 108 | recorded_at: Thu, 03 Oct 2019 12:07:16 GMT 109 | recorded_with: VCR 4.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-media_next_track.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Oct 2019 12:07:10 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - 53507e4ddb533acdca04c85e956d5d0b 42 | Etag: 43 | - W/"fee0c127f31e354aae63ac0325c6cce4" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - e0c1920f-ebca-44d5-818e-419632e19b30 48 | X-Runtime: 49 | - '0.034419' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","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,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 53 | http_version: 54 | recorded_at: Thu, 03 Oct 2019 12:07:10 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_next_track 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | headers: 62 | User-Agent: 63 | - github.com/timdorr/tesla-api v:3.0.1 64 | Authorization: 65 | - Bearer 66 | Content-Length: 67 | - '0' 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | Server: 78 | - nginx 79 | Date: 80 | - Thu, 03 Oct 2019 12:07:11 GMT 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Content-Length: 84 | - '40' 85 | Connection: 86 | - keep-alive 87 | X-Frame-Options: 88 | - SAMEORIGIN 89 | - SAMEORIGIN 90 | X-Xss-Protection: 91 | - 1; mode=block 92 | X-Content-Type-Options: 93 | - nosniff 94 | X-Txid: 95 | - 3378733fc84bfc9a0d8ca8829f3e061e 96 | Etag: 97 | - W/"f67eec105dd6522783a1f1bacc52723a" 98 | Cache-Control: 99 | - max-age=0, private, must-revalidate 100 | X-Request-Id: 101 | - 7d4d8512-ede6-47f7-bec0-0d8827369cce 102 | X-Runtime: 103 | - '0.233400' 104 | body: 105 | encoding: UTF-8 106 | string: '{"response":{"reason":"","result":true}}' 107 | http_version: 108 | recorded_at: Thu, 03 Oct 2019 12:07:11 GMT 109 | recorded_with: VCR 4.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-media_prev_fav.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Oct 2019 12:07:13 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - ebdbffdab2c2775c54baa8da990d85bf 42 | Etag: 43 | - W/"fee0c127f31e354aae63ac0325c6cce4" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - c88974d9-c7d5-4082-a197-6b0106a1272b 48 | X-Runtime: 49 | - '0.043550' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","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,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 53 | http_version: 54 | recorded_at: Thu, 03 Oct 2019 12:07:13 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_prev_fav 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | headers: 62 | User-Agent: 63 | - github.com/timdorr/tesla-api v:3.0.1 64 | Authorization: 65 | - Bearer 66 | Content-Length: 67 | - '0' 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | Server: 78 | - nginx 79 | Date: 80 | - Thu, 03 Oct 2019 12:07:14 GMT 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Content-Length: 84 | - '40' 85 | Connection: 86 | - keep-alive 87 | X-Frame-Options: 88 | - SAMEORIGIN 89 | - SAMEORIGIN 90 | X-Xss-Protection: 91 | - 1; mode=block 92 | X-Content-Type-Options: 93 | - nosniff 94 | X-Txid: 95 | - 6a65e94c22f4feabfcacfe9695305d8b 96 | Etag: 97 | - W/"f67eec105dd6522783a1f1bacc52723a" 98 | Cache-Control: 99 | - max-age=0, private, must-revalidate 100 | X-Request-Id: 101 | - 8e593817-2ce5-4ce7-89e2-9543421af7a3 102 | X-Runtime: 103 | - '0.438129' 104 | body: 105 | encoding: UTF-8 106 | string: '{"response":{"reason":"","result":true}}' 107 | http_version: 108 | recorded_at: Thu, 03 Oct 2019 12:07:14 GMT 109 | recorded_with: VCR 4.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-media_prev_track.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Oct 2019 12:07:12 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - 6a2031faf6edd5db7dbd035750238f13 42 | Etag: 43 | - W/"fee0c127f31e354aae63ac0325c6cce4" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - 5beba8de-97b6-4372-8db7-8cd727aafbc0 48 | X-Runtime: 49 | - '0.024729' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","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,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 53 | http_version: 54 | recorded_at: Thu, 03 Oct 2019 12:07:12 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_prev_track 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | headers: 62 | User-Agent: 63 | - github.com/timdorr/tesla-api v:3.0.1 64 | Authorization: 65 | - Bearer 66 | Content-Length: 67 | - '0' 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | Server: 78 | - nginx 79 | Date: 80 | - Thu, 03 Oct 2019 12:07:13 GMT 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Content-Length: 84 | - '40' 85 | Connection: 86 | - keep-alive 87 | X-Frame-Options: 88 | - SAMEORIGIN 89 | - SAMEORIGIN 90 | X-Xss-Protection: 91 | - 1; mode=block 92 | X-Content-Type-Options: 93 | - nosniff 94 | X-Txid: 95 | - dbb5802aa39b5317ccdf1c02efb3c686 96 | Etag: 97 | - W/"f67eec105dd6522783a1f1bacc52723a" 98 | Cache-Control: 99 | - max-age=0, private, must-revalidate 100 | X-Request-Id: 101 | - 0f31b943-eee3-437d-a6a2-4c06a09a97c7 102 | X-Runtime: 103 | - '0.411534' 104 | body: 105 | encoding: UTF-8 106 | string: '{"response":{"reason":"","result":true}}' 107 | http_version: 108 | recorded_at: Thu, 03 Oct 2019 12:07:13 GMT 109 | recorded_with: VCR 4.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-media_toggle_playback.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Oct 2019 12:07:07 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - dfaa20808000cca42d2d5e236eaf33a9 42 | Etag: 43 | - W/"fee0c127f31e354aae63ac0325c6cce4" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - d6c767b3-4425-4ddf-91f4-b3c3823db73f 48 | X-Runtime: 49 | - '0.018363' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","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,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 53 | http_version: 54 | recorded_at: Thu, 03 Oct 2019 12:07:07 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_toggle_playback 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | headers: 62 | User-Agent: 63 | - github.com/timdorr/tesla-api v:3.0.1 64 | Authorization: 65 | - Bearer 66 | Content-Length: 67 | - '0' 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | Server: 78 | - nginx 79 | Date: 80 | - Thu, 03 Oct 2019 12:07:08 GMT 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Content-Length: 84 | - '40' 85 | Connection: 86 | - keep-alive 87 | X-Frame-Options: 88 | - SAMEORIGIN 89 | - SAMEORIGIN 90 | X-Xss-Protection: 91 | - 1; mode=block 92 | X-Content-Type-Options: 93 | - nosniff 94 | X-Txid: 95 | - 0fb86e2b83309cbf87ad5e4aa322ee26 96 | Etag: 97 | - W/"f67eec105dd6522783a1f1bacc52723a" 98 | Cache-Control: 99 | - max-age=0, private, must-revalidate 100 | X-Request-Id: 101 | - 84566bae-cfc5-4818-92db-a2b48be0bf0a 102 | X-Runtime: 103 | - '0.466495' 104 | body: 105 | encoding: UTF-8 106 | string: '{"response":{"reason":"","result":true}}' 107 | http_version: 108 | recorded_at: Thu, 03 Oct 2019 12:07:08 GMT 109 | recorded_with: VCR 4.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-media_volume_down.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Oct 2019 12:07:05 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - 796921f5a214dd0e5ffef9a7c098732e 42 | Etag: 43 | - W/"fee0c127f31e354aae63ac0325c6cce4" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - 6dce7691-3341-49e9-9336-f643b343ba6c 48 | X-Runtime: 49 | - '0.024369' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","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,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 53 | http_version: 54 | recorded_at: Thu, 03 Oct 2019 12:07:05 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_volume_down 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | headers: 62 | User-Agent: 63 | - github.com/timdorr/tesla-api v:3.0.1 64 | Authorization: 65 | - Bearer 66 | Content-Length: 67 | - '0' 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | Server: 78 | - nginx 79 | Date: 80 | - Thu, 03 Oct 2019 12:07:06 GMT 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Content-Length: 84 | - '40' 85 | Connection: 86 | - keep-alive 87 | X-Frame-Options: 88 | - SAMEORIGIN 89 | - SAMEORIGIN 90 | X-Xss-Protection: 91 | - 1; mode=block 92 | X-Content-Type-Options: 93 | - nosniff 94 | X-Txid: 95 | - 7d39d164b7236420df18cd8f493f3aa9 96 | Etag: 97 | - W/"f67eec105dd6522783a1f1bacc52723a" 98 | Cache-Control: 99 | - max-age=0, private, must-revalidate 100 | X-Request-Id: 101 | - 54ca8542-89ef-491a-b936-a21347a0a69e 102 | X-Runtime: 103 | - '0.427457' 104 | body: 105 | encoding: UTF-8 106 | string: '{"response":{"reason":"","result":true}}' 107 | http_version: 108 | recorded_at: Thu, 03 Oct 2019 12:07:07 GMT 109 | recorded_with: VCR 4.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-media_volume_up.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Oct 2019 12:07:09 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - 0bdb6b5922a2eb417845f8cc734b9575 42 | Etag: 43 | - W/"fee0c127f31e354aae63ac0325c6cce4" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - 644429de-81cd-4254-a568-368fa64ac962 48 | X-Runtime: 49 | - '0.023907' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","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,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 53 | http_version: 54 | recorded_at: Thu, 03 Oct 2019 12:07:09 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_volume_up 58 | body: 59 | encoding: UTF-8 60 | string: '' 61 | headers: 62 | User-Agent: 63 | - github.com/timdorr/tesla-api v:3.0.1 64 | Authorization: 65 | - Bearer 66 | Content-Length: 67 | - '0' 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | Server: 78 | - nginx 79 | Date: 80 | - Thu, 03 Oct 2019 12:07:10 GMT 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Content-Length: 84 | - '40' 85 | Connection: 86 | - keep-alive 87 | X-Frame-Options: 88 | - SAMEORIGIN 89 | - SAMEORIGIN 90 | X-Xss-Protection: 91 | - 1; mode=block 92 | X-Content-Type-Options: 93 | - nosniff 94 | X-Txid: 95 | - e755be3a3feafe691897ee6a73d76776 96 | Etag: 97 | - W/"f67eec105dd6522783a1f1bacc52723a" 98 | Cache-Control: 99 | - max-age=0, private, must-revalidate 100 | X-Request-Id: 101 | - 1816dbf7-4dec-4914-bc70-2eed155517da 102 | X-Runtime: 103 | - '0.339461' 104 | body: 105 | encoding: UTF-8 106 | string: '{"response":{"reason":"","result":true}}' 107 | http_version: 108 | recorded_at: Thu, 03 Oct 2019 12:07:10 GMT 109 | recorded_with: VCR 4.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-mobile_enabled.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 00:16:43 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - 7db3115ac739350f5fdd0c45fd1e46ed 41 | X-Runtime: 42 | - '0.494930' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"7b266a228263ec2bbe821b6de916437bcaaf251a6b282ed6b8026670f85aec12","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 00:16:45 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 7b266a228263ec2bbe821b6de916437bcaaf251a6b282ed6b8026670f85aec12 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 00:16:47 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"c5d083718f906b7336fb8b28fcc87b6c"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 764f037a10ac8d13c2c4c2f17bb01065 82 | X-Runtime: 83 | - '2.909714' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["6b6e59059375f282","09b1673648be8c08"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 00:16:49 GMT 89 | - request: 90 | method: get 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/mobile_enabled 92 | body: 93 | encoding: US-ASCII 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer 7b266a228263ec2bbe821b6de916437bcaaf251a6b282ed6b8026670f85aec12 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 00:16:51 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '17' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"0bd75264337702d501fe87ce0b52dc08"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - e2fba5c75d503a78f5abf05fccadf74b 123 | X-Runtime: 124 | - '3.193111' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":true}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 00:16:53 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-navigation_request.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.3.0 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Tue, 11 Dec 2018 03:52:42 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '659' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - 133482a0eb21b88a3bbb970d365529f5 38 | Etag: 39 | - W/"0d85a34aa9e150f718d20dc8c7a68fb1" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - cec88ce0-2eee-40c6-9f7b-4ae66fa0770b 44 | X-Runtime: 45 | - '0.018938' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["08f5098517a10231","8d219a2e09242e02"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Tue, 11 Dec 2018 03:52:42 GMT 52 | - request: 53 | method: post 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/navigation_request 55 | body: 56 | encoding: UTF-8 57 | string: type=share_ext_content_raw&locale=en-US×tamp_ms=1544500362&value[android.intent.extra.TEXT]=1180%20W%20Peachtree%20St%2C%20Atlanta%2C%20GA%2030309 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.3.0 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Tue, 11 Dec 2018 03:52:43 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '43' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | - SAMEORIGIN 81 | X-Xss-Protection: 82 | - 1; mode=block 83 | X-Content-Type-Options: 84 | - nosniff 85 | X-Txid: 86 | - 0f96fb719f1b87111da5f4809ca3e19a 87 | Etag: 88 | - W/"6c93a9ca22c89240ebbffee93abe0348" 89 | Cache-Control: 90 | - max-age=0, private, must-revalidate 91 | X-Request-Id: 92 | - 1b4238b5-00f7-4187-8f85-e45da6124c05 93 | X-Runtime: 94 | - '0.459076' 95 | body: 96 | encoding: UTF-8 97 | string: '{"response":{"result":true,"queued":false}}' 98 | http_version: 99 | recorded_at: Tue, 11 Dec 2018 03:52:43 GMT 100 | recorded_with: VCR 4.0.0 101 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-nearby_charging_sites.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.3.0 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Tue, 11 Dec 2018 04:01:43 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '659' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - c21a79d3bc8fbefa118a466bd7841dbb 38 | Etag: 39 | - W/"0b0233c8e9ab2c7fcdba390a757e034a" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - d7a6f72b-9737-4697-8240-5fb746579067 44 | X-Runtime: 45 | - '0.018695' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["921c1c9a2f2b479a","08f5098517a10231"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Tue, 11 Dec 2018 04:01:43 GMT 52 | - request: 53 | method: get 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/nearby_charging_sites 55 | body: 56 | encoding: US-ASCII 57 | string: '' 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.3.0 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 400 66 | message: Bad Request 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Tue, 11 Dec 2018 04:01:44 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '67' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | X-Xss-Protection: 81 | - 1; mode=block 82 | X-Content-Type-Options: 83 | - nosniff 84 | Cache-Control: 85 | - no-cache 86 | X-Request-Id: 87 | - e01a24c4-d7b3-445e-a628-3f37c8bc1cfb 88 | X-Runtime: 89 | - '0.185555' 90 | body: 91 | encoding: UTF-8 92 | string: '{"response":null,"error":"invalid_endpoint","error_description":""}' 93 | http_version: 94 | recorded_at: Tue, 11 Dec 2018 04:01:44 GMT 95 | recorded_with: VCR 4.0.0 96 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-open_frunk.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Sun, 05 Aug 2018 17:04:59 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '623' 25 | Connection: 26 | - keep-alive 27 | X-Frame-Options: 28 | - SAMEORIGIN 29 | - SAMEORIGIN 30 | X-Xss-Protection: 31 | - 1; mode=block 32 | X-Content-Type-Options: 33 | - nosniff 34 | X-Txid: 35 | - 951bcecdd2d7f67c62ad15c00c7ce012 36 | Etag: 37 | - W/"a78143581fd077eaa11b6ca4674b0d08" 38 | Cache-Control: 39 | - max-age=0, private, must-revalidate 40 | X-Request-Id: 41 | - e9f132ac-784d-4191-87f5-a9db6c20a68b 42 | X-Runtime: 43 | - '0.075622' 44 | body: 45 | encoding: UTF-8 46 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["13e0ae629c708af6","156102684b1be0dd"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 47 | http_version: 48 | recorded_at: Sun, 05 Aug 2018 17:04:59 GMT 49 | - request: 50 | method: post 51 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/actuate_trunk 52 | body: 53 | encoding: UTF-8 54 | string: which_trunk=front 55 | headers: 56 | Authorization: 57 | - Bearer 58 | response: 59 | status: 60 | code: 200 61 | message: OK 62 | headers: 63 | Server: 64 | - nginx 65 | Date: 66 | - Sun, 05 Aug 2018 17:04:59 GMT 67 | Content-Type: 68 | - application/json; charset=utf-8 69 | Content-Length: 70 | - '40' 71 | Connection: 72 | - keep-alive 73 | X-Frame-Options: 74 | - SAMEORIGIN 75 | - SAMEORIGIN 76 | X-Xss-Protection: 77 | - 1; mode=block 78 | X-Content-Type-Options: 79 | - nosniff 80 | X-Txid: 81 | - 442bc3f4fb49eabadd5ec4ab5af8d7d6 82 | Etag: 83 | - W/"f67eec105dd6522783a1f1bacc52723a" 84 | Cache-Control: 85 | - max-age=0, private, must-revalidate 86 | X-Request-Id: 87 | - 0549c8ca-3e1b-40b9-bd90-430015b6ddde 88 | X-Runtime: 89 | - '0.083773' 90 | body: 91 | encoding: UTF-8 92 | string: '{"response":{"reason":"","result":true}}' 93 | http_version: 94 | recorded_at: Sun, 05 Aug 2018 17:04:59 GMT 95 | recorded_with: VCR 3.0.3 96 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-open_trunk.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Sun, 05 Aug 2018 17:05:00 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '623' 25 | Connection: 26 | - keep-alive 27 | X-Frame-Options: 28 | - SAMEORIGIN 29 | - SAMEORIGIN 30 | X-Xss-Protection: 31 | - 1; mode=block 32 | X-Content-Type-Options: 33 | - nosniff 34 | X-Txid: 35 | - 47beb347d84e5640bf8650afc5a5d290 36 | Etag: 37 | - W/"6406a0c92e8caf93d1f9120da1610420" 38 | Cache-Control: 39 | - max-age=0, private, must-revalidate 40 | X-Request-Id: 41 | - 00374a64-8682-4b3f-9fd3-a801f43c60b0 42 | X-Runtime: 43 | - '0.014727' 44 | body: 45 | encoding: UTF-8 46 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["13e0ae629c708af6","156102684b1be0dd"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 47 | http_version: 48 | recorded_at: Sun, 05 Aug 2018 17:05:00 GMT 49 | - request: 50 | method: post 51 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/actuate_trunk 52 | body: 53 | encoding: UTF-8 54 | string: which_trunk=front 55 | headers: 56 | Authorization: 57 | - Bearer 58 | response: 59 | status: 60 | code: 200 61 | message: OK 62 | headers: 63 | Server: 64 | - nginx 65 | Date: 66 | - Sun, 05 Aug 2018 17:05:00 GMT 67 | Content-Type: 68 | - application/json; charset=utf-8 69 | Content-Length: 70 | - '40' 71 | Connection: 72 | - keep-alive 73 | X-Frame-Options: 74 | - SAMEORIGIN 75 | - SAMEORIGIN 76 | X-Xss-Protection: 77 | - 1; mode=block 78 | X-Content-Type-Options: 79 | - nosniff 80 | X-Txid: 81 | - 5e6adf1c1e9a73c310d45820d88451aa 82 | Etag: 83 | - W/"f67eec105dd6522783a1f1bacc52723a" 84 | Cache-Control: 85 | - max-age=0, private, must-revalidate 86 | X-Request-Id: 87 | - 845150c1-1b8d-4ee9-8690-65f60cfeb48f 88 | X-Runtime: 89 | - '0.131305' 90 | body: 91 | encoding: UTF-8 92 | string: '{"response":{"reason":"","result":true}}' 93 | http_version: 94 | recorded_at: Sun, 05 Aug 2018 17:05:00 GMT 95 | recorded_with: VCR 3.0.3 96 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-remote_start_drive.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:58:18 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - 364c03e28fd4b67781c902ad6f25e0ed 41 | X-Runtime: 42 | - '0.517522' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"f6f692b74fc8ffb4b31df7ae126fbc169e31860aafcb57f9393857f1f72e0b87","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:58:20 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer f6f692b74fc8ffb4b31df7ae126fbc169e31860aafcb57f9393857f1f72e0b87 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:58:19 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"43fa46d8ef01858addb3fa8a8d54e93e"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - cd24c5ab71307fa2b3cad8efc2c2d5c5 82 | X-Runtime: 83 | - '0.074052' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["156102684b1be0dd","b1278e37b13e8df2"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:58:20 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/remote_start_drive 92 | body: 93 | encoding: UTF-8 94 | string: '' 95 | headers: 96 | Authorization: 97 | - Bearer f6f692b74fc8ffb4b31df7ae126fbc169e31860aafcb57f9393857f1f72e0b87 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:58:21 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - c47f14d97844f5be6084dc1fedc56c98 123 | X-Runtime: 124 | - '2.171873' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:58:23 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-reset_valet_pin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Sat, 23 Jan 2016 18:38:15 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '526' 25 | Connection: 26 | - keep-alive 27 | Status: 28 | - 200 OK 29 | X-Ua-Compatible: 30 | - IE=Edge,chrome=1 31 | Etag: 32 | - '"1a341f7e69533f4f8201999a4732d298"' 33 | Cache-Control: 34 | - max-age=0, private, must-revalidate 35 | X-Request-Id: 36 | - 0cb5d6356855f3ffdc77ff604b5be599 37 | X-Runtime: 38 | - '0.242210' 39 | body: 40 | encoding: UTF-8 41 | string: '{"response":[{"color":null,"display_name":"Nikola","id":49800504717279029,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["b3c212faedd98d90","29435ecf655ed476"],"state":"online","id_s":"49800504717279029","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 42 | http_version: 43 | recorded_at: Sat, 23 Jan 2016 18:38:15 GMT 44 | - request: 45 | method: post 46 | uri: https://owner-api.teslamotors.com/api/1/vehicles/49800504717279029/command/reset_valet_pin 47 | body: 48 | encoding: UTF-8 49 | string: '' 50 | headers: 51 | Authorization: 52 | - Bearer 53 | response: 54 | status: 55 | code: 200 56 | message: OK 57 | headers: 58 | Server: 59 | - nginx 60 | Date: 61 | - Sat, 23 Jan 2016 18:38:16 GMT 62 | Content-Type: 63 | - application/json; charset=utf-8 64 | Content-Length: 65 | - '40' 66 | Connection: 67 | - keep-alive 68 | Status: 69 | - 200 OK 70 | X-Ua-Compatible: 71 | - IE=Edge,chrome=1 72 | Etag: 73 | - '"f67eec105dd6522783a1f1bacc52723a"' 74 | Cache-Control: 75 | - max-age=0, private, must-revalidate 76 | X-Request-Id: 77 | - 5c81d2c0bd2d440c60fa4aa6d532d10c 78 | X-Runtime: 79 | - '0.402684' 80 | body: 81 | encoding: UTF-8 82 | string: '{"response":{"reason":"","result":true}}' 83 | http_version: 84 | recorded_at: Sat, 23 Jan 2016 18:38:16 GMT 85 | recorded_with: VCR 2.9.3 86 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-schedule_software_update.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.3.0 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Tue, 11 Dec 2018 03:59:52 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '659' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - 7ba6b0ffa0a12110ff272668fe5654cd 38 | Etag: 39 | - W/"0d85a34aa9e150f718d20dc8c7a68fb1" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - 5d47f7df-9017-4222-8c17-af1670dcdb47 44 | X-Runtime: 45 | - '0.020096' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["08f5098517a10231","8d219a2e09242e02"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Tue, 11 Dec 2018 03:59:52 GMT 52 | - request: 53 | method: post 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/schedule_software_update 55 | body: 56 | encoding: UTF-8 57 | string: offset_sec=7200 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.3.0 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Tue, 11 Dec 2018 03:59:53 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '159' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | - SAMEORIGIN 81 | X-Xss-Protection: 82 | - 1; mode=block 83 | X-Content-Type-Options: 84 | - nosniff 85 | X-Txid: 86 | - 619c829cb360874596a6326d3e950279 87 | Etag: 88 | - W/"842860ac949644ddb069883f17553de5" 89 | Cache-Control: 90 | - max-age=0, private, must-revalidate 91 | X-Request-Id: 92 | - d61d0bfc-9895-477f-9759-6ea5a31fc51a 93 | X-Runtime: 94 | - '0.701839' 95 | body: 96 | encoding: UTF-8 97 | string: '{"response":{"expected_duration_sec":6000,"reason":"","result":true,"scheduled_time_ms":1544500793459,"status":"scheduled","warning_time_remaining_ms":120000}}' 98 | http_version: 99 | recorded_at: Tue, 11 Dec 2018 03:59:53 GMT 100 | recorded_with: VCR 4.0.0 101 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-seat_heater_request.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.4.1 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Sun, 24 Feb 2019 01:43:45 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '560' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - c4c935f820bb983ab39c3cb55cff40b9 38 | Etag: 39 | - W/"ab623a35dcb4358cb8efa907f4c48acb" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - 3937089b-c69c-51a9-b30b-3c5cc32bab5a 44 | X-Runtime: 45 | - '0.031140' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["921c1c9a2f2b479a","08f5098517a10231"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Sun, 24 Feb 2019 01:43:45 GMT 52 | - request: 53 | method: post 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/remote_seat_heater_request 55 | body: 56 | encoding: UTF-8 57 | string: heater=1&level=0 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.4.1 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Sun, 24 Feb 2019 01:43:46 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '40' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | - SAMEORIGIN 81 | X-Xss-Protection: 82 | - 1; mode=block 83 | X-Content-Type-Options: 84 | - nosniff 85 | X-Txid: 86 | - 285c2b1b42411a224af014a336d5a3c2 87 | Etag: 88 | - W/"17f1bc21c0a8289b664a341515a4815a" 89 | Cache-Control: 90 | - max-age=0, private, must-revalidate 91 | X-Request-Id: 92 | - 532f50af-01aa-34ca-81cf-441a43c1c4c1 93 | X-Runtime: 94 | - '0.296134' 95 | body: 96 | encoding: UTF-8 97 | string: '{"response":{"reason":"","result":true}}' 98 | http_version: 99 | recorded_at: Sun, 24 Feb 2019 01:43:46 GMT 100 | recorded_with: VCR 4.0.0 101 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-set_charge_limit-100.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:32:35 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - a37959a7b3594cb9f1a56dc605e0bcc4 41 | X-Runtime: 42 | - '0.410277' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"62d3a001566ba9e334f93ef14c03bdf6d6cbee80aaa48b6a790f8eb00a8034e7","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:32:36 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 62d3a001566ba9e334f93ef14c03bdf6d6cbee80aaa48b6a790f8eb00a8034e7 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:32:35 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"c52908b8db9336f89e7a1602f3b2a458"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 5e1c692deda17a6d324a0c217ebe4196 82 | X-Runtime: 83 | - '0.160918' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["b1278e37b13e8df2","b2fd1ad42f706a73"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:32:37 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/set_charge_limit 92 | body: 93 | encoding: UTF-8 94 | string: percent=100 95 | headers: 96 | Authorization: 97 | - Bearer 62d3a001566ba9e334f93ef14c03bdf6d6cbee80aaa48b6a790f8eb00a8034e7 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:32:36 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - 82054b3b03a8456718c070ffeb884293 123 | X-Runtime: 124 | - '0.726342' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:32:38 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-set_charging_amps-10.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - Faraday v1.8.0 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | X-Xss-Protection: 24 | - 1; mode=block 25 | X-Txid: 26 | - b9fab48906f303228008fddf9d1ea38c 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Etag: 30 | - W/"c40db12fce1e2b2c9c2aac35867f12bd" 31 | X-Request-Id: 32 | - 72d8204a-ee5c-462f-81ef-908cae2b38bf 33 | Content-Length: 34 | - '581' 35 | X-Envoy-Upstream-Service-Time: 36 | - '65' 37 | X-Envoy-Upstream-Cluster: 38 | - owner-api 39 | X-Frame-Options: 40 | - DENY 41 | X-Content-Type-Options: 42 | - nosniff 43 | Strict-Transport-Security: 44 | - max-age=31536000; includeSubDomains 45 | Cache-Control: 46 | - no-cache, no-store, private, s-max-age=0 47 | Date: 48 | - Fri, 26 Nov 2021 09:02:14 GMT 49 | Server: 50 | - envoy 51 | body: 52 | encoding: UTF-8 53 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["8d219a2e09242e02","b12ead7cd34f97da"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 54 | recorded_at: Fri, 26 Nov 2021 09:02:14 GMT 55 | - request: 56 | method: post 57 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/set_charging_amps 58 | body: 59 | encoding: UTF-8 60 | string: '{"charging_amps":10}' 61 | headers: 62 | User-Agent: 63 | - Faraday v1.8.0 64 | Authorization: 65 | - Bearer 66 | Content-Type: 67 | - application/json 68 | Accept-Encoding: 69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 70 | Accept: 71 | - "*/*" 72 | response: 73 | status: 74 | code: 200 75 | message: OK 76 | headers: 77 | X-Xss-Protection: 78 | - 1; mode=block 79 | X-Txid: 80 | - 3a36142faf14b855316771206b4451ed 81 | Content-Type: 82 | - application/json; charset=utf-8 83 | Etag: 84 | - W/"47b5151a189abf369d67f15cd80c7adb" 85 | X-Request-Id: 86 | - 56d5455d-9727-4187-88cf-2720f5acc508 87 | Content-Length: 88 | - '40' 89 | X-Envoy-Upstream-Service-Time: 90 | - '219' 91 | X-Envoy-Upstream-Cluster: 92 | - owner-api 93 | X-Frame-Options: 94 | - DENY 95 | X-Content-Type-Options: 96 | - nosniff 97 | Strict-Transport-Security: 98 | - max-age=31536000; includeSubDomains 99 | Cache-Control: 100 | - no-cache, no-store, private, s-max-age=0 101 | Date: 102 | - Fri, 26 Nov 2021 09:02:14 GMT 103 | Server: 104 | - envoy 105 | body: 106 | encoding: UTF-8 107 | string: '{"response":{"result":true,"reason":""}}' 108 | recorded_at: Fri, 26 Nov 2021 09:02:14 GMT 109 | recorded_with: VCR 6.0.0 110 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-set_sentry_mode.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.4.1 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Fri, 22 Mar 2019 22:23:24 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '560' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - d02f4ff21a6e1b268a665750baffc710 38 | Etag: 39 | - W/"1be15a507d094a87368028f8dfaccd1a" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - 4d46929a-f37f-b435-b780-76264949a802 44 | X-Runtime: 45 | - '0.021684' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["08f5098517a10231","8d219a2e09242e02"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Fri, 22 Mar 2019 22:23:24 GMT 52 | - request: 53 | method: post 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/set_sentry_mode 55 | body: 56 | encoding: UTF-8 57 | string: on=false 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.4.1 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Fri, 22 Mar 2019 22:23:24 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '40' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | - SAMEORIGIN 81 | X-Xss-Protection: 82 | - 1; mode=block 83 | X-Content-Type-Options: 84 | - nosniff 85 | X-Txid: 86 | - 748a70910e1c191df6af18bb3f51a99f 87 | Etag: 88 | - W/"8b2ba34e0e680eb9a2f93ca92ef3cc49" 89 | Cache-Control: 90 | - max-age=0, private, must-revalidate 91 | X-Request-Id: 92 | - f6208b15-2060-b4d6-2484-408c50576015 93 | X-Runtime: 94 | - '0.195483' 95 | body: 96 | encoding: UTF-8 97 | string: '{"response":{"reason":"","result":true}}' 98 | http_version: 99 | recorded_at: Fri, 22 Mar 2019 22:23:24 GMT 100 | recorded_with: VCR 4.0.0 101 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-set_speed_limit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Wed, 18 Jul 2018 23:51:18 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '623' 25 | Connection: 26 | - keep-alive 27 | X-Frame-Options: 28 | - SAMEORIGIN 29 | - SAMEORIGIN 30 | X-Xss-Protection: 31 | - 1; mode=block 32 | X-Content-Type-Options: 33 | - nosniff 34 | X-Txid: 35 | - 0dd1f1f026f902339fe4bb629429d653 36 | Etag: 37 | - W/"6958697e3e1e010f56068d8c7fa2f93d" 38 | Cache-Control: 39 | - max-age=0, private, must-revalidate 40 | X-Request-Id: 41 | - 810ad995-1c32-4527-9b55-3158ab119e1b 42 | X-Runtime: 43 | - '0.027684' 44 | body: 45 | encoding: UTF-8 46 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["a1f3fab6393d3a6a","91a139ce322eed65"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 47 | http_version: 48 | recorded_at: Wed, 18 Jul 2018 23:51:18 GMT 49 | - request: 50 | method: post 51 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/speed_limit_set_limit 52 | body: 53 | encoding: UTF-8 54 | string: limit_mph=65 55 | headers: 56 | Authorization: 57 | - Bearer 58 | response: 59 | status: 60 | code: 200 61 | message: OK 62 | headers: 63 | Server: 64 | - nginx 65 | Date: 66 | - Wed, 18 Jul 2018 23:51:19 GMT 67 | Content-Type: 68 | - application/json; charset=utf-8 69 | Content-Length: 70 | - '40' 71 | Connection: 72 | - keep-alive 73 | X-Frame-Options: 74 | - SAMEORIGIN 75 | - SAMEORIGIN 76 | X-Xss-Protection: 77 | - 1; mode=block 78 | X-Content-Type-Options: 79 | - nosniff 80 | X-Txid: 81 | - 47cdfaf37f13879846e19ed31441ade3 82 | Etag: 83 | - W/"f67eec105dd6522783a1f1bacc52723a" 84 | Cache-Control: 85 | - max-age=0, private, must-revalidate 86 | X-Request-Id: 87 | - 0523f468-6cde-4ae4-8dd3-870de69ad2f4 88 | X-Runtime: 89 | - '0.112159' 90 | body: 91 | encoding: UTF-8 92 | string: '{"response":{"reason":"","result":true}}' 93 | http_version: 94 | recorded_at: Wed, 18 Jul 2018 23:51:19 GMT 95 | recorded_with: VCR 3.0.3 96 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-set_valet_mode.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | Authorization: 11 | - Bearer 12 | response: 13 | status: 14 | code: 200 15 | message: OK 16 | headers: 17 | Server: 18 | - nginx 19 | Date: 20 | - Sat, 23 Jan 2016 18:39:42 GMT 21 | Content-Type: 22 | - application/json; charset=utf-8 23 | Content-Length: 24 | - '526' 25 | Connection: 26 | - keep-alive 27 | Status: 28 | - 200 OK 29 | X-Ua-Compatible: 30 | - IE=Edge,chrome=1 31 | Etag: 32 | - '"1a341f7e69533f4f8201999a4732d298"' 33 | Cache-Control: 34 | - max-age=0, private, must-revalidate 35 | X-Request-Id: 36 | - 0c957b2d043ce894fcc3fd98adb511e4 37 | X-Runtime: 38 | - '0.099915' 39 | body: 40 | encoding: UTF-8 41 | string: '{"response":[{"color":null,"display_name":"Nikola","id":49800504717279029,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["b3c212faedd98d90","29435ecf655ed476"],"state":"online","id_s":"49800504717279029","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 42 | http_version: 43 | recorded_at: Sat, 23 Jan 2016 18:39:43 GMT 44 | - request: 45 | method: post 46 | uri: https://owner-api.teslamotors.com/api/1/vehicles/49800504717279029/command/set_valet_mode 47 | body: 48 | encoding: UTF-8 49 | string: on=true&password=1234 50 | headers: 51 | Authorization: 52 | - Bearer 53 | response: 54 | status: 55 | code: 200 56 | message: OK 57 | headers: 58 | Server: 59 | - nginx 60 | Date: 61 | - Sat, 23 Jan 2016 18:39:45 GMT 62 | Content-Type: 63 | - application/json; charset=utf-8 64 | Content-Length: 65 | - '40' 66 | Connection: 67 | - keep-alive 68 | Status: 69 | - 200 OK 70 | X-Ua-Compatible: 71 | - IE=Edge,chrome=1 72 | Etag: 73 | - '"f67eec105dd6522783a1f1bacc52723a"' 74 | Cache-Control: 75 | - max-age=0, private, must-revalidate 76 | X-Request-Id: 77 | - ad2ab96494fe4ae4f04b80d806a18956 78 | X-Runtime: 79 | - '0.689346' 80 | body: 81 | encoding: UTF-8 82 | string: '{"response":{"reason":"","result":true}}' 83 | http_version: 84 | recorded_at: Sat, 23 Jan 2016 18:39:44 GMT 85 | recorded_with: VCR 2.9.3 86 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-steering_wheel_heater_request.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:1.4.1 12 | Authorization: 13 | - Bearer 14 | response: 15 | status: 16 | code: 200 17 | message: OK 18 | headers: 19 | Server: 20 | - nginx 21 | Date: 22 | - Sun, 24 Feb 2019 01:45:31 GMT 23 | Content-Type: 24 | - application/json; charset=utf-8 25 | Content-Length: 26 | - '560' 27 | Connection: 28 | - keep-alive 29 | X-Frame-Options: 30 | - SAMEORIGIN 31 | - SAMEORIGIN 32 | X-Xss-Protection: 33 | - 1; mode=block 34 | X-Content-Type-Options: 35 | - nosniff 36 | X-Txid: 37 | - 6f71bbfe2f7d615dd53dd27a7d561083 38 | Etag: 39 | - W/"ac52d151f70236be8a2fd76cc3a7e215" 40 | Cache-Control: 41 | - max-age=0, private, must-revalidate 42 | X-Request-Id: 43 | - beacbab2-72a5-7a1b-ecba-c73c1cd249af 44 | X-Runtime: 45 | - '0.013103' 46 | body: 47 | encoding: UTF-8 48 | string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 49 | 2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["08f5098517a10231","8d219a2e09242e02"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 50 | http_version: 51 | recorded_at: Sun, 24 Feb 2019 01:45:31 GMT 52 | - request: 53 | method: post 54 | uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/remote_steering_wheel_heater_request 55 | body: 56 | encoding: UTF-8 57 | string: on=false 58 | headers: 59 | User-Agent: 60 | - github.com/timdorr/tesla-api v:1.4.1 61 | Authorization: 62 | - Bearer 63 | response: 64 | status: 65 | code: 200 66 | message: OK 67 | headers: 68 | Server: 69 | - nginx 70 | Date: 71 | - Sun, 24 Feb 2019 01:45:32 GMT 72 | Content-Type: 73 | - application/json; charset=utf-8 74 | Content-Length: 75 | - '40' 76 | Connection: 77 | - keep-alive 78 | X-Frame-Options: 79 | - SAMEORIGIN 80 | - SAMEORIGIN 81 | X-Xss-Protection: 82 | - 1; mode=block 83 | X-Content-Type-Options: 84 | - nosniff 85 | X-Txid: 86 | - b0b529831abb830179558ade3f3b4622 87 | Etag: 88 | - W/"b834d18aa9a08081d6e257c5dc7af1f0" 89 | Cache-Control: 90 | - max-age=0, private, must-revalidate 91 | X-Request-Id: 92 | - 3f6c3479-8549-b5f3-32cc-39745e4b75aa 93 | X-Runtime: 94 | - '0.320113' 95 | body: 96 | encoding: UTF-8 97 | string: '{"response":{"reason":"","result":true}}' 98 | http_version: 99 | recorded_at: Sun, 24 Feb 2019 01:45:32 GMT 100 | recorded_with: VCR 4.0.0 101 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-sun_roof_control-close.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Wed, 17 Dec 2014 01:38:03 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - 37a528ec5d1196e53807fb17abeece6e 41 | X-Runtime: 42 | - '1.329704' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"75d223b8157db1dc22897bd03056dc6987703dbd3a440067b75282a0b2211dd4","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Wed, 17 Dec 2014 01:38:05 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 75d223b8157db1dc22897bd03056dc6987703dbd3a440067b75282a0b2211dd4 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Wed, 17 Dec 2014 01:38:04 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"c52908b8db9336f89e7a1602f3b2a458"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - 40789ea7d352c4be1c1e65d537c91cdb 82 | X-Runtime: 83 | - '0.293284' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["b1278e37b13e8df2","b2fd1ad42f706a73"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Wed, 17 Dec 2014 01:38:05 GMT 89 | - request: 90 | method: post 91 | uri: https://owner-api.teslamotors.com/api/1/vehicles/1514029006966957156/command/sun_roof_control 92 | body: 93 | encoding: UTF-8 94 | string: state=close 95 | headers: 96 | Authorization: 97 | - Bearer 75d223b8157db1dc22897bd03056dc6987703dbd3a440067b75282a0b2211dd4 98 | response: 99 | status: 100 | code: 200 101 | message: OK 102 | headers: 103 | Server: 104 | - nginx 105 | Date: 106 | - Wed, 17 Dec 2014 01:38:04 GMT 107 | Content-Type: 108 | - application/json; charset=utf-8 109 | Content-Length: 110 | - '40' 111 | Connection: 112 | - keep-alive 113 | Status: 114 | - 200 OK 115 | X-Ua-Compatible: 116 | - IE=Edge,chrome=1 117 | Etag: 118 | - '"f67eec105dd6522783a1f1bacc52723a"' 119 | Cache-Control: 120 | - max-age=0, private, must-revalidate 121 | X-Request-Id: 122 | - eb4260d20a22ce25e909b1cd034ad67d 123 | X-Runtime: 124 | - '0.201775' 125 | body: 126 | encoding: UTF-8 127 | string: '{"response":{"reason":"","result":true}}' 128 | http_version: 129 | recorded_at: Wed, 17 Dec 2014 01:38:06 GMT 130 | recorded_with: VCR 2.9.3 131 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle-vehicle_config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: https://owner-api.teslamotors.com/api/1/vehicles 6 | body: 7 | encoding: US-ASCII 8 | string: '' 9 | headers: 10 | User-Agent: 11 | - github.com/timdorr/tesla-api v:3.0.1 12 | Authorization: 13 | - Bearer 14 | Accept-Encoding: 15 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 16 | Accept: 17 | - "*/*" 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Fri, 04 Oct 2019 18:43:37 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Content-Length: 30 | - '569' 31 | Connection: 32 | - keep-alive 33 | X-Frame-Options: 34 | - SAMEORIGIN 35 | - SAMEORIGIN 36 | X-Xss-Protection: 37 | - 1; mode=block 38 | X-Content-Type-Options: 39 | - nosniff 40 | X-Txid: 41 | - ee7eb2a310951d5233614c26c511bf48 42 | Etag: 43 | - W/"c1c1ac03906b1b753f519905aa9afe41" 44 | Cache-Control: 45 | - max-age=0, private, must-revalidate 46 | X-Request-Id: 47 | - c0d6ac7d-91a5-426e-b1cb-d9403b888e52 48 | X-Runtime: 49 | - '0.030921' 50 | body: 51 | encoding: UTF-8 52 | string: '{"response":[{"id":26640707449551857,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola 53 | 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,"tokens":["db33b4d51c05cad8","cb2c4a4304d797fe"],"state":"online","in_service":false,"id_s":"26640707449551857","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}' 54 | http_version: 55 | recorded_at: Fri, 04 Oct 2019 18:43:37 GMT 56 | - request: 57 | method: get 58 | uri: https://owner-api.teslamotors.com/api/1/vehicles/26640707449551857/data_request/vehicle_config 59 | body: 60 | encoding: US-ASCII 61 | string: '' 62 | headers: 63 | User-Agent: 64 | - github.com/timdorr/tesla-api v:3.0.1 65 | Authorization: 66 | - Bearer 67 | Accept-Encoding: 68 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 69 | Accept: 70 | - "*/*" 71 | response: 72 | status: 73 | code: 200 74 | message: OK 75 | headers: 76 | Server: 77 | - nginx 78 | Date: 79 | - Fri, 04 Oct 2019 18:43:40 GMT 80 | Content-Type: 81 | - application/json; charset=utf-8 82 | Content-Length: 83 | - '546' 84 | Connection: 85 | - keep-alive 86 | X-Frame-Options: 87 | - SAMEORIGIN 88 | - SAMEORIGIN 89 | X-Xss-Protection: 90 | - 1; mode=block 91 | X-Content-Type-Options: 92 | - nosniff 93 | X-Txid: 94 | - 643a147148ac6a15b224e5bcb3fb932c 95 | Etag: 96 | - W/"88b28a01a971376d0cf561987d6c8a61" 97 | Cache-Control: 98 | - max-age=0, private, must-revalidate 99 | X-Request-Id: 100 | - 6ce094c9-81a8-4227-bb4f-8244e8df49ae 101 | X-Runtime: 102 | - '1.870441' 103 | body: 104 | encoding: UTF-8 105 | string: '{"response":{"can_accept_navigation_requests":true,"can_actuate_trunks":true,"car_special_type":"base","car_type":"models2","charge_port_type":"US","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":1570214620099,"trim_badging":"p90d","use_range_badging":false,"wheel_type":"AeroTurbine19"}}' 106 | http_version: 107 | recorded_at: Fri, 04 Oct 2019 18:43:40 GMT 108 | recorded_with: VCR 5.0.0 109 | -------------------------------------------------------------------------------- /spec/cassettes/vehicle.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: post 5 | uri: https://owner-api.teslamotors.com/oauth/token 6 | body: 7 | encoding: UTF-8 8 | string: grant_type=password&client_id=&client_secret=&email=&password= 9 | headers: 10 | Accept-Encoding: 11 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 12 | Accept: 13 | - "*/*" 14 | User-Agent: 15 | - Ruby 16 | response: 17 | status: 18 | code: 200 19 | message: OK 20 | headers: 21 | Server: 22 | - nginx 23 | Date: 24 | - Mon, 15 Dec 2014 04:42:49 GMT 25 | Content-Type: 26 | - application/json; charset=utf-8 27 | Transfer-Encoding: 28 | - chunked 29 | Connection: 30 | - keep-alive 31 | Status: 32 | - 200 OK 33 | Cache-Control: 34 | - no-store 35 | Pragma: 36 | - no-cache 37 | X-Ua-Compatible: 38 | - IE=Edge,chrome=1 39 | X-Request-Id: 40 | - 8f8740e0685ac8fc647ef935ca48fbaf 41 | X-Runtime: 42 | - '0.628793' 43 | body: 44 | encoding: UTF-8 45 | string: '{"access_token":"7740526bd5eb7d9d24421e6f3b37a7ca226aba9c508719dc673338425625771c","token_type":"bearer","expires_in":7776000}' 46 | http_version: 47 | recorded_at: Mon, 15 Dec 2014 04:42:49 GMT 48 | - request: 49 | method: get 50 | uri: https://owner-api.teslamotors.com/api/1/vehicles 51 | body: 52 | encoding: US-ASCII 53 | string: '' 54 | headers: 55 | Authorization: 56 | - Bearer 7740526bd5eb7d9d24421e6f3b37a7ca226aba9c508719dc673338425625771c 57 | response: 58 | status: 59 | code: 200 60 | message: OK 61 | headers: 62 | Server: 63 | - nginx 64 | Date: 65 | - Mon, 15 Dec 2014 04:42:50 GMT 66 | Content-Type: 67 | - application/json; charset=utf-8 68 | Content-Length: 69 | - '446' 70 | Connection: 71 | - keep-alive 72 | Status: 73 | - 200 OK 74 | X-Ua-Compatible: 75 | - IE=Edge,chrome=1 76 | Etag: 77 | - '"89d57312f9ec321aacf9b239c20308fc"' 78 | Cache-Control: 79 | - max-age=0, private, must-revalidate 80 | X-Request-Id: 81 | - ea98a1d1bbd2d88330f543c23fb92a4d 82 | X-Runtime: 83 | - '0.389659' 84 | body: 85 | encoding: UTF-8 86 | string: '{"response":[{"color":null,"display_name":"Nikola","id":1514029006966957156,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013,COUS","vehicle_id":490215852,"vin":"5YJSA1CN5CFP01657","tokens":["99b8958b9408b1ac","79eb37ed5c55fe6a"],"state":"online","remote_start_enabled":true,"calendar_enabled":true,"notifications_enabled":true}],"count":1}' 87 | http_version: 88 | recorded_at: Mon, 15 Dec 2014 04:42:50 GMT 89 | recorded_with: VCR 2.9.3 90 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require "dotenv" 2 | require "vcr" 3 | require "webmock/rspec" 4 | 5 | require "tesla_api" 6 | 7 | Dotenv.load 8 | 9 | VCR.configure do |c| 10 | c.cassette_library_dir = "spec/cassettes" 11 | c.hook_into :webmock 12 | c.default_cassette_options = {record: :once} 13 | c.configure_rspec_metadata! 14 | 15 | c.define_cassette_placeholder("") { CGI.escape(ENV["TESLA_EMAIL"]) } 16 | c.define_cassette_placeholder("") { ENV["TESLA_PASS"] } 17 | c.define_cassette_placeholder("") { ENV["TESLA_CLIENT_ID"] } 18 | c.define_cassette_placeholder("") { ENV["TESLA_CLIENT_SECRET"] } 19 | c.define_cassette_placeholder("") { ENV["TESLA_ACCESS_TOKEN"] } 20 | c.define_cassette_placeholder("") { ENV["TESLA_REFRESH_TOKEN"] } 21 | end 22 | 23 | RSpec.configure do |config| 24 | config.expect_with :rspec do |expectations| 25 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 26 | end 27 | 28 | config.mock_with :rspec do |mocks| 29 | mocks.verify_partial_doubles = true 30 | end 31 | 32 | config.disable_monkey_patching! 33 | config.order = :random 34 | Kernel.srand config.seed 35 | end 36 | -------------------------------------------------------------------------------- /tesla_api.gemspec: -------------------------------------------------------------------------------- 1 | require File.expand_path("../lib/tesla_api/version", __FILE__) 2 | 3 | Gem::Specification.new do |spec| 4 | spec.name = "tesla_api" 5 | spec.version = TeslaApi::VERSION 6 | spec.authors = ["Tim Dorr"] 7 | spec.email = ["timdorr@timdorr.com"] 8 | spec.summary = "A wrapper for the Tesla JSON API" 9 | spec.description = "Check the state of your Tesla Model S and issue basic commands. Stream data from the car's telematics system." 10 | spec.homepage = "https://github.com/timdorr/tesla-api" 11 | spec.license = "MIT" 12 | 13 | spec.files = `git ls-files -z`.split("\0") 14 | spec.require_paths = ["lib"] 15 | 16 | spec.add_dependency "async-websocket" 17 | spec.add_dependency "faraday" 18 | spec.add_dependency "faraday_middleware" 19 | 20 | spec.add_development_dependency "bundler", "~> 2.0" 21 | spec.add_development_dependency "rake", "~> 13.0" 22 | spec.add_development_dependency "rspec", "~> 3.1" 23 | spec.add_development_dependency "rotp", "~> 6.2" 24 | spec.add_development_dependency "standard", "~> 1.0" 25 | spec.add_development_dependency "vcr", "~> 6.0" 26 | spec.add_development_dependency "webmock", "~> 3.0" 27 | spec.add_development_dependency "dotenv", "~> 2.0" 28 | end 29 | -------------------------------------------------------------------------------- /vault.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | /* unused */ 4 | enum ActiveVaultReason { 5 | ACTIVE_VAULT_REASON_UNKNOWN = 0; 6 | ACTIVE_VAULT_REASON_OWNER = 1; 7 | ACTIVE_VAULT_REASON_NETWORK = 2; 8 | ACTIVE_VAULT_REASON_WALKUP = 3; 9 | ACTIVE_VAULT_REASON_OPEN = 4; 10 | } 11 | 12 | message EncryptedData { 13 | bytes data = 1; 14 | bytes iv = 2; 15 | bytes tag = 3; 16 | } 17 | 18 | message Item { 19 | int64 modifiedAt = 1; 20 | bytes label = 2; 21 | EncryptedData data = 3; 22 | RemoteData remoteData = 4; 23 | bytes referenceId = 5; 24 | bool labelIsPlaintext = 6; 25 | } 26 | message OpenVault { 27 | string uuid = 1; 28 | } 29 | 30 | message OptIn { 31 | VaultInfo vaultInfo = 1; 32 | string pin = 4; 33 | bytes pubkey = 5; 34 | } 35 | 36 | /* unused */ 37 | message OptIns { 38 | repeated OptIn optIns = 1; 39 | } 40 | 41 | message RemoteClientKey { 42 | repeated VaultKey pubkeys = 1; 43 | } 44 | 45 | /* used in carserver... perhaps that's how we manipulate things? */ 46 | message RemoteCommand { 47 | oneof sub_message { 48 | OptIn optIn = 1; 49 | OpenVault openVault = 2; 50 | } 51 | } 52 | 53 | message RemoteData { 54 | string url = 1; 55 | bytes etag = 2; 56 | bytes sha = 3; 57 | } 58 | 59 | message UnencryptedItem { 60 | int64 modifiedAt = 1; 61 | bytes data = 2; 62 | } 63 | 64 | /* probably what we receive on /vault_profile */ 65 | message Vault { 66 | string uuid = 1; 67 | repeated VaultClass classes = 2; 68 | VaultInfo vaultInfo = 3; 69 | RemoteClientKey remoteClientKey = 4; 70 | bytes pubkeysReferenceId = 5; 71 | } 72 | 73 | message VaultClass { 74 | string name = 1; 75 | EncryptedData labelKey = 2; 76 | EncryptedData dataKey = 3; 77 | repeated Item items = 4; 78 | repeated WrappedClassKey wrappedClassKeys = 5; 79 | } 80 | 81 | message VaultInfo { 82 | string uuid = 1; 83 | string publicUsername = 2; 84 | UnencryptedItem publicProfilePicture = 3; 85 | string publicGamername = 4; 86 | } 87 | 88 | /* unused */ 89 | message VaultInfos { 90 | repeated VaultInfo vaultInfos = 1; 91 | } 92 | 93 | message VaultKey { 94 | vaultKeyType vaultKeyType = 1; 95 | string pubkey = 2; 96 | } 97 | 98 | message WrappedClassKey { 99 | string name = 1; 100 | bytes key = 2; 101 | string pubkeyId = 3; 102 | } 103 | 104 | enum vaultKeyType { 105 | VEHICLE_CERT = 0; 106 | MOBILE_ID = 1; 107 | MOBILE_BACKUP_PUBKEY = 2; 108 | } 109 | --------------------------------------------------------------------------------