diff --git a/docs/vehicle/state/climatestate.md b/docs/vehicle/state/climatestate.md index a4bf6481..4c6b2e30 100644 --- a/docs/vehicle/state/climatestate.md +++ b/docs/vehicle/state/climatestate.md @@ -11,6 +11,7 @@ Information on the current internal temperature and climate control system. "response": { "battery_heater": false, "battery_heater_no_power": false, + "climate_keeper_mode": "dog", "driver_temp_setting": 21.6, "fan_status": 0, "inside_temp": null, diff --git a/docs/vehicle/state/data.md b/docs/vehicle/state/data.md index 4908ffaf..f9b545e2 100644 --- a/docs/vehicle/state/data.md +++ b/docs/vehicle/state/data.md @@ -21,7 +21,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration. "in_service": false, "id_s": "12345678901234567", "calendar_enabled": true, - "api_version": 4, + "api_version": 6, "backseat_token": null, "backseat_token_updated_at": null, "drive_state": { @@ -41,6 +41,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration. "climate_state": { "battery_heater": false, "battery_heater_no_power": false, + "climate_keeper_mode": "dog", "driver_temp_setting": 21.6, "fan_status": 0, "inside_temp": null, @@ -54,14 +55,15 @@ A rollup of all the `data_request` endpoints plus vehicle configuration. "min_avail_temp": 15.0, "outside_temp": null, "passenger_temp_setting": 21.6, + "remote_heater_control_enabled": true, "right_temp_direction": null, - "seat_heater_left": false, - "seat_heater_rear_center": false, - "seat_heater_rear_left": false, + "seat_heater_left": 3, + "seat_heater_rear_center": 0, + "seat_heater_rear_left": 1, "seat_heater_rear_left_back": 0, - "seat_heater_rear_right": false, + "seat_heater_rear_right": 1, "seat_heater_rear_right_back": 0, - "seat_heater_right": false, + "seat_heater_right": 2, "side_mirror_heaters": false, "smart_preconditioning": false, "steering_wheel_heater": false, @@ -82,6 +84,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration. "charge_limit_soc_std": 90, "charge_miles_added_ideal": 50.0, "charge_miles_added_rated": 40.0, + "charge_port_cold_weather_mode": false, "charge_port_door_open": false, "charge_port_latch": "Engaged", "charge_rate": 0.0, @@ -120,7 +123,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration. "timestamp": 1543186971728 }, "vehicle_state": { - "api_version": 4, + "api_version": 6, "autopark_state_v2": "standby", "autopark_style": "standard", "calendar_supported": true, @@ -140,8 +143,10 @@ A rollup of all the `data_request` endpoints plus vehicle configuration. "pf": 0, "pr": 0, "remote_start": false, + "remote_start_enabled": true, "remote_start_supported": true, "rt": 0, + "sentry_mode": true, "software_update": { "expected_duration_sec": 2700, "status": "" }, "speed_limit_mode": { "active": false, @@ -167,6 +172,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration. "exterior_color": "White", "has_air_suspension": true, "has_ludicrous_mode": false, + "key_version": 1, "motorized_charge_port": true, "perf_config": "P2", "plg": true, diff --git a/docs/vehicle/state/vehicleconfig.md b/docs/vehicle/state/vehicleconfig.md index 84c7fe75..d8e91f62 100644 --- a/docs/vehicle/state/vehicleconfig.md +++ b/docs/vehicle/state/vehicleconfig.md @@ -18,6 +18,7 @@ Returns the vehicle's configuration information including model, color, badging "exterior_color": "White", "has_air_suspension": true, "has_ludicrous_mode": false, + "key_version": 1, "motorized_charge_port": true, "perf_config": "P2", "plg": true, diff --git a/docs/vehicle/state/vehiclestate.md b/docs/vehicle/state/vehiclestate.md index 9289bd7d..22556248 100644 --- a/docs/vehicle/state/vehiclestate.md +++ b/docs/vehicle/state/vehiclestate.md @@ -9,7 +9,7 @@ Returns the vehicle's physical state, such as which doors are open. ```json { "response": { - "api_version": 4, + "api_version": 6, "autopark_state_v2": "ready", "autopark_style": "standard", "calendar_supported": true, @@ -29,8 +29,10 @@ Returns the vehicle's physical state, such as which doors are open. "pf": 0, "pr": 0, "remote_start": false, + "remote_start_enabled": true, "remote_start_supported": true, "rt": 0, + "sentry_mode": true, "software_update": { "expected_duration_sec": 2700, "status": "" }, "speed_limit_mode": { "active": false, diff --git a/lib/tesla_api/vehicle.rb b/lib/tesla_api/vehicle.rb index 31287001..919d9427 100644 --- a/lib/tesla_api/vehicle.rb +++ b/lib/tesla_api/vehicle.rb @@ -190,6 +190,10 @@ def set_steering_wheel_heater(on) command('remote_steering_wheel_heater_request', body: {on: on})['response'] end + def set_sentry_mode(on) + command('set_sentry_mode', body: {on: on})['response'] + end + private def data_request(name) diff --git a/spec/cassettes/vehicle-set_sentry_mode.yml b/spec/cassettes/vehicle-set_sentry_mode.yml new file mode 100644 index 00000000..eddff8ae --- /dev/null +++ b/spec/cassettes/vehicle-set_sentry_mode.yml @@ -0,0 +1,100 @@ +--- +http_interactions: +- request: + method: get + uri: https://owner-api.teslamotors.com/api/1/vehicles + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - github.com/timdorr/tesla-api v:1.4.1 + Authorization: + - Bearer + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Fri, 22 Mar 2019 22:23:24 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '560' + Connection: + - keep-alive + X-Frame-Options: + - SAMEORIGIN + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + X-Txid: + - d02f4ff21a6e1b268a665750baffc710 + Etag: + - W/"1be15a507d094a87368028f8dfaccd1a" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - 4d46929a-f37f-b435-b780-76264949a802 + X-Runtime: + - '0.021684' + body: + encoding: UTF-8 + string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola + 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}' + http_version: + recorded_at: Fri, 22 Mar 2019 22:23:24 GMT +- request: + method: post + uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/set_sentry_mode + body: + encoding: UTF-8 + string: on=false + headers: + User-Agent: + - github.com/timdorr/tesla-api v:1.4.1 + Authorization: + - Bearer + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Fri, 22 Mar 2019 22:23:24 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '40' + Connection: + - keep-alive + X-Frame-Options: + - SAMEORIGIN + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + X-Txid: + - 748a70910e1c191df6af18bb3f51a99f + Etag: + - W/"8b2ba34e0e680eb9a2f93ca92ef3cc49" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - f6208b15-2060-b4d6-2484-408c50576015 + X-Runtime: + - '0.195483' + body: + encoding: UTF-8 + string: '{"response":{"reason":"","result":true}}' + http_version: + recorded_at: Fri, 22 Mar 2019 22:23:24 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/lib/tesla_api/vehicle_spec.rb b/spec/lib/tesla_api/vehicle_spec.rb index 8a2470d7..28e849b2 100644 --- a/spec/lib/tesla_api/vehicle_spec.rb +++ b/spec/lib/tesla_api/vehicle_spec.rb @@ -329,4 +329,10 @@ expect(vehicle.set_steering_wheel_heater(false)['result']).to eq(true) end end + + describe '#set_sentry_mode', vcr: {cassette_name: 'vehicle-set_sentry_mode'} do + it 'disables sentry mode' do + expect(vehicle.set_sentry_mode(false)['result']).to eq(true) + end + end end