tesla-api icon indicating copy to clipboard operation
tesla-api copied to clipboard

Vehicle In Service

Open HarmOtten opened this issue 6 years ago • 10 comments

Currently the Tesla-App shows that my vehicle is In Service, but when I look at the response from the Tesla-API request "vehicle" or "vehicle_data", the field "in_service" shows False. So there must be another way/command of detecting whether a Tesla is in service or not. Any ideas?

HarmOtten avatar Aug 15 '19 14:08 HarmOtten

What do you get back from the vehicle_data endpoint? It's probably pulling from there.

timdorr avatar Aug 15 '19 16:08 timdorr

Yes, and this is the complete response:

{
    "id": **********************,
    "user_id": *********,
    "vehicle_id": ***************,
    "vin": "****************",
    "display_name": "Jupiter",
    "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": [
        "****************",
        "****************"
    ],
    "state": "online",
    "in_service": false,
    "id_s": "57812065898986398",
    "calendar_enabled": true,
    "api_version": 6,
    "backseat_token": null,
    "backseat_token_updated_at": null,
    "charge_state": {
        "battery_heater_on": false,
        "battery_level": 35,
        "battery_range": 107.32,
        "charge_current_request": 16,
        "charge_current_request_max": 16,
        "charge_enable_request": true,
        "charge_energy_added": 0,
        "charge_limit_soc": 50,
        "charge_limit_soc_max": 100,
        "charge_limit_soc_min": 50,
        "charge_limit_soc_std": 90,
        "charge_miles_added_ideal": 0,
        "charge_miles_added_rated": 0,
        "charge_port_cold_weather_mode": false,
        "charge_port_door_open": false,
        "charge_port_latch": "Engaged",
        "charge_rate": 0,
        "charge_to_max_range": false,
        "charger_actual_current": 0,
        "charger_phases": null,
        "charger_pilot_current": 16,
        "charger_power": 0,
        "charger_voltage": 2,
        "charging_state": "Disconnected",
        "conn_charge_cable": "<invalid>",
        "est_battery_range": 114.72,
        "fast_charger_brand": "<invalid>",
        "fast_charger_present": false,
        "fast_charger_type": "<invalid>",
        "ideal_battery_range": 107.32,
        "managed_charging_active": false,
        "managed_charging_start_time": null,
        "managed_charging_user_canceled": false,
        "max_range_charge_counter": 0,
        "minutes_to_full_charge": 0,
        "not_enough_power_to_heat": null,
        "scheduled_charging_pending": false,
        "scheduled_charging_start_time": null,
        "time_to_full_charge": 0,
        "timestamp": 1565889340343,
        "trip_charging": false,
        "usable_battery_level": 35,
        "user_charge_enable_request": null
    },
    "climate_state": {
        "battery_heater": false,
        "battery_heater_no_power": null,
        "climate_keeper_mode": "off",
        "driver_temp_setting": 22.5,
        "fan_status": 0,
        "inside_temp": 25.1,
        "is_auto_conditioning_on": false,
        "is_climate_on": false,
        "is_front_defroster_on": false,
        "is_preconditioning": false,
        "is_rear_defroster_on": false,
        "left_temp_direction": 0,
        "max_avail_temp": 28,
        "min_avail_temp": 15,
        "outside_temp": 25.5,
        "passenger_temp_setting": 22.5,
        "remote_heater_control_enabled": false,
        "right_temp_direction": 0,
        "seat_heater_left": 0,
        "seat_heater_rear_center": 0,
        "seat_heater_rear_left": 0,
        "seat_heater_rear_right": 0,
        "seat_heater_right": 0,
        "side_mirror_heaters": false,
        "smart_preconditioning": false,
        "timestamp": 1565889340343,
        "wiper_blade_heater": false
    },
    "drive_state": {
        "gps_as_of": 1565879624,
        "heading": 175,
        "latitude": *********,
        "longitude": **********,
        "native_latitude": **********,
        "native_location_supported": 1,
        "native_longitude": **********,
        "native_type": "wgs",
        "power": 0,
        "shift_state": null,
        "speed": null,
        "timestamp": 1565889340343
    },
    "gui_settings": {
        "gui_24_hour_time": true,
        "gui_charge_rate_units": "km/hr",
        "gui_distance_units": "km/hr",
        "gui_range_display": "Rated",
        "gui_temperature_units": "C",
        "show_range_units": false,
        "timestamp": 1565889340343
    },
    "vehicle_config": {
        "can_accept_navigation_requests": true,
        "can_actuate_trunks": true,
        "car_special_type": "base",
        "car_type": "model3",
        "charge_port_type": "CCS",
        "eu_vehicle": true,
        "exterior_color": "RedMulticoat",
        "has_air_suspension": false,
        "has_ludicrous_mode": false,
        "key_version": 2,
        "motorized_charge_port": true,
        "plg": false,
        "rear_seat_heaters": 1,
        "rear_seat_type": null,
        "rhd": false,
        "roof_color": "Glass",
        "seat_type": null,
        "spoiler_type": "None",
        "sun_roof_installed": null,
        "third_row_seats": "<invalid>",
        "timestamp": 1565889340344,
        "use_range_badging": true,
        "wheel_type": "Pinwheel18"
    },
    "vehicle_state": {
        "api_version": 6,
        "autopark_state_v2": "standby",
        "autopark_style": "dead_man",
        "calendar_supported": true,
        "car_version": "2019.28.1 4ff958d",
        "center_display_state": 0,
        "df": 0,
        "dr": 0,
        "ft": 16,
        "homelink_nearby": false,
        "is_user_present": false,
        "last_autopark_error": "no_error",
        "locked": false,
        "media_state": {
            "remote_control_enabled": true
        },
        "notifications_supported": true,
        "odometer": 1719.594525,
        "parsed_calendar_supported": true,
        "pf": 0,
        "pr": 0,
        "remote_start": false,
        "remote_start_enabled": true,
        "remote_start_supported": true,
        "rt": 0,
        "sentry_mode": false,
        "sentry_mode_available": true,
        "software_update": {
            "expected_duration_sec": 1500,
            "status": "available"
        },
        "speed_limit_mode": {
            "active": false,
            "current_limit_mph": 86.864113,
            "max_limit_mph": 90,
            "min_limit_mph": 50,
            "pin_code_set": false
        },
        "sun_roof_percent_open": null,
        "sun_roof_state": "unknown",
        "timestamp": 1565889340343,
        "valet_mode": false,
        "vehicle_name": "Jupiter"
    }
}

HarmOtten avatar Aug 15 '19 17:08 HarmOtten

There is a newer service_data endpoint that we haven't documented yet. That might have something in it: https://github.com/timdorr/tesla-api/blob/master/docs/miscellaneous/endpoints.md#L44

timdorr avatar Aug 15 '19 17:08 timdorr

That's it! Brilliant, thanks! The endpoint with URL "api/1/vehicles/{vehicle_id}/service_data" delivers this:

{
    "service_etc": "2019-08-15T14:15:00+02:00",
    "service_status": "in_service"
}

HarmOtten avatar Aug 15 '19 18:08 HarmOtten

Simple enough! Thanks for the response. I'll see about getting that documented.

timdorr avatar Aug 15 '19 18:08 timdorr

@timdorr there is an issue with the option_codes retrieved from the API. The same codes show for all of my cars, model x or model 3 are showing the same codes as the OP. Any idea what could be going wrong here? Additional ref: https://www.reddit.com/r/teslamotors/comments/b9xsn1/just_pulled_the_full_set_of_option_codes_from_my/

MrgSub avatar Sep 20 '19 02:09 MrgSub

@MrgSub This issue has nothing to do with option codes...

timdorr avatar Sep 20 '19 04:09 timdorr

@timdorr Would you please elaborate more?

MrgSub avatar Sep 20 '19 07:09 MrgSub

@MrgSub You're posting in an issue about a vehicle being in service. This isn't the right thread of discussion.

timdorr avatar Sep 20 '19 14:09 timdorr

Old thread, I know but do we know what happens or the response if you try to submit an action? Is there a specific response?

dacastro4 avatar Jul 30 '21 16:07 dacastro4