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

Reverse engineering the new Scheduled Charging API endpoints

This site may earn commission on affiliate links.
Has anyone (or does anyone know of someone who has) tried to reverse engineer the relatively new scheduling endpoints in the owner API?

Specifically, I'm referring to the following endpoints:

Code:
/set_scheduled_charging
/set_scheduled_departure

I have managed to decode some of the parameters needed.

/set_scheduled_departure


For this endpoint I've managed to verify the following parameters:

JSON:
{
    "enable": true, // ✅
    "preconditioning_enabled": true, // ✅
    "off_peak_charging_enabled": true, // ✅
}

However, passing the preconditioning_times and off_peak_charging_times parameters, which are returned under /charge_state (with possible values all_week | weekdays), does not work.

JSON:
{
    "preconditioning_times": "weekdays", // or "all_week" ❌
    "off_peak_charging_times": "weekdays", // or "all_week" ❌
}

Similarly, and most importantly, I cannot figure out how to set the timestamps. I've agin tried the posting same parameters as returned on /charge_state:

JSON:
{
    "scheduled_departure_time": 1636243200, // epoch timestamp ❌
    "off_peak_hours_end_time": 1400 // Minutes after midnight ❌
}

But every time all timestamps are reverted to 00:00, just as when not passing any timestamp parameters.


/set_scheduled_charging​


Exactly the same goes for this endpoint. I have only managed to confirm one parameter:

JSON:
{
    "enable": true // ✅
}

Once again, I cannot figure out how to set the time. I've tried

JSON:
{
    "scheduled_charging_start_time": 1636243400 // epoch ❌
}

as is returned on /charge_state .

Any insights (or references to such) are much appreciated!

Main source of inspiration​

As mentioned above, I tried to the the values returned in the /charge_state endpoint to figure out what parameters and values to send. For reference, this is what that looks like for these features:

JSON:
{
    //...
    "off_peak_charging_enabled": false,
    "off_peak_charging_times": "all_week",
    "off_peak_hours_end_time": 0,
    "preconditioning_enabled": false,
    "preconditioning_times": "all_week",
    "scheduled_charging_mode": "StartAt",
    "scheduled_charging_pending": true,
    "scheduled_charging_start_time": 1636243200,
    "scheduled_departure_time": 1636239600
    //...
}