tesla_owner_api

Creator: coderz1093

Last updated:

0 purchases

tesla_owner_api Image
tesla_owner_api Images

Languages

Categories

Add to Cart

Description:

tesla owner api

Tesla Owner API #
Warning #
Please note that this is an unofficial API, using https://www.teslaapi.io/, and therefore, we cannot guarantee its functionality. It's recommended to use it with caution as changes in the official API can break this library. Always ensure you're adhering to Tesla's terms of service while using this API.

The TeslaAPI is the main class for accessing the Tesla Owner API. It includes properties for authentication and for accessing different parts of the Tesla Owner API.
Properties #

auth: An instance of the Auth class used for authentication.
energySites: An instance of the EnergySites class used for interacting with energy sites.
powerWalls: An instance of the PowerWalls class used for interacting with Powerwalls.
products: An instance of the Products class used for interacting with Tesla products.
user: An instance of the User class used for interacting with the user's account.
vehicles: An instance of the Vehicles class used for interacting with the user's Tesla vehicles.

Constructors #
TeslaAPI.auth() #
Creates a TeslaAPI instance with authentication. This constructor initializes the auth property for authentication purposes.
Usage
var teslaAPIAuth = TeslaAPI.auth();
String accessToken = teslaAPIAuth.getAccessToken(String email, String password,
String clientId, String clientSecret);
copied to clipboard
TeslaAPI(String token) #
Creates a TeslaAPI instance with an access token. This constructor initializes various properties for accessing different parts of the Tesla Owner API using the provided access token.
Parameters

token: The access token to authenticate requests.

Usage
var teslaAPI = TeslaAPI('your_access_token_here');
copied to clipboard
Now you can use all the Methods like
var user = teslaAPI.user;
var energysites = teslaAPI.energysites;
var powerwalls = teslaAPI.powerwalls;
var products = teslaAPI.products;
copied to clipboard
Features #

User
Future
Fetches Powerwall order entry data for a user. Returns a Response object containing the data. Throws an Exception if the request fails.
var powerwallOrderEntryData = await teslaAPI.user.getPowerwallOrderEntryData();
copied to clipboard
Future
Fetches onboarding data for a user. Returns a Response object containing the data. Throws an Exception if the request fails.
var onboardingData = await teslaAPI.user.getOnboardingData();
copied to clipboard
Future
Fetches referral data for a user. Returns a Response object containing the data. Throws an `Exception if the request fails.
var referralData = await teslaAPI.user.getReferralData();
copied to clipboard
Future
Sends a device key. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

deviceKey: The device key to be sent.

var response = await teslaAPI.user.sendDeviceKey('your_device_key_here');
copied to clipboard
Future
Sends a command token. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

commandToken: The command token to be sent.

var response = await teslaAPI.user.sendCommandToken('your_command_token_here');
copied to clipboard


EnergySites
State and Settings #
Future
Fetches the status summary for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response siteStatusSummary = await teslaAPI.energysites.siteStatusSummary('your_site_id_here');
copied to clipboard
Future
Fetches the live status data for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response siteLiveStatusData = await teslaAPI.energysites.siteLiveStatusData('your_site_id_here');
copied to clipboard
Future
Fetches the configuration information for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response siteConfiguration = await teslaAPI.energysites.siteConfiguration('your_site_id_here');
copied to clipboard
Future
Fetches the historical data for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response siteHistory = await teslaAPI.energysites.siteHistory('your_site_id_here');
copied to clipboard
Commands #
Future
Sets the backup energy reserve for a specific energy site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response reserveResult = await teslaAPI.energysites.commands.backupEnergyReserve('your_site_id_here');
copied to clipboard
Future
Fetches the historical data for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response siteName = await teslaAPI.energysites.commands.siteName('your_site_id_here');
copied to clipboard
Future
Fetches the operation mode for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response operationMode = await teslaAPI.energysites.commands.operationMode('your_site_id_here');
copied to clipboard
Future
Fetches the time of use settings for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response timeOfUseSettings = await teslaAPI.energysites.commands.timeOfUseSettings('your_site_id_here');
copied to clipboard
Future
Fetches the storm mode for a specific site. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

siteId: The ID of the site.

Response stormMode = await teslaAPI.energysites.commands.stormMode('your_site_id_here');
copied to clipboard


PowerWalls
State and Settings #
Future
Fetch the current Battery Status. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

batteryId: The ID of the battery.

Response batteryStatus = await teslaAPI.powerwalls.commands.getBatteryStatus('your_battery_id_here');
copied to clipboard
Future
Fetch the current Battery Data. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

batteryId: The ID of the battery.

Response batteryData = await teslaAPI.powerwalls.commands.getBatteryData('your_battery_id_here');
copied to clipboard
Future
Fetch the Battery Power Time-series Data. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

batteryId: The ID of the battery.

Response batteryPowerTimeSeriesData = await teslaAPI.powerwalls.commands.getBatteryPowerTimeSeriesData('your_battery_id_here');
copied to clipboard
Future
Fetch the Battery Power Time-series Data. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

batteryId: The ID of the battery.

Response batteryEnergyTimeSeriesData = await teslaAPI.powerwalls.commands.getBatteryEnergyTimeSeriesData('your_battery_id_here');
copied to clipboard
Commands #
Future
Backup the Battery Reserve. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

batteryId: The ID of the battery.

Response backupBatteryReserve = await teslaAPI.powerwalls.commands.batterySiteName('your_battery_id_here');
copied to clipboard
Future
Fetches the site name of a specific battery. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

batteryId: The ID of the battery.

Response batterySiteName = await teslaAPI.powerwalls.commands.backupBatteryReserve('your_battery_id_here');
copied to clipboard
Future
Fetches the operation mode of a specific battery. Returns a Response object containing the data. Throws an `Exception if the request fails.
Parameters

batteryId: The ID of the battery.

Response batteryOperationMode = await teslaAPI.powerwalls.commands.batteryOperationMode('your_battery_id_here');
copied to clipboard


Products
Future
Fetches a list of products. Returns a Response object containing the data. Throws an `Exception if the request fails.
var productsList = await teslaAPI.products.getProducts();
copied to clipboard


Vehicles
List #
Future
Fetches a list of vehicles. Returns a VehicleList object containing the data. Throws an `Exception if the request fails.
VehicleList allVehicles = await teslaAPI.vehicles.getAllVehicles();
copied to clipboard
Future
Fetches data for a specific vehicle. Returns a Vehicle object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

Vehicle specificVehicle = await teslaAPI.vehicles.getSpecificVehicle('your_vehicle_id_here');
copied to clipboard
State and Settings #
Future
Fetches the legacy vehicle data. Returns a Vehicle object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

Vehicle legacyVehicleData = await teslaAPI.vehicles.getLegacyVehicleData('your_vehicle_id_here');
copied to clipboard
Future
Fetches the vehicle data. Returns a Vehicle object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

Vehicle vehicleData = await teslaAPI.vehicles.getVehicleData('your_vehicle_id_here');
copied to clipboard
Future
Fetches the vehicle service data. Returns a Vehicle object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

Vehicle vehicleServiceData = await teslaAPI.vehicles.getVehicleServiceData('your_vehicle_id_here');
copied to clipboard
Future
Checks if mobile is enabled for the vehicle. Returns a bool indicating whether mobile is enabled. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

bool isMobileEnabled = await teslaAPI.vehicles.isMobileEnabled('your_vehicle_id_here');
copied to clipboard
Future
Fetches the charge state of the vehicle. Returns a ChargeState object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ChargeState chargeState = await teslaAPI.vehicles.getChargeState('your_vehicle_id_here');
copied to clipboard
Future
Fetches the climate state of the vehicle. Returns a ClimateState object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ClimateState climateState = await teslaAPI.vehicles.getClimateState('your_vehicle_id_here');
copied to clipboard
Future
Fetches the drive state of the vehicle. Returns a DriveState object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

DriveState driveState = await teslaAPI.vehicles.getDriveState('your_vehicle_id_here');
copied to clipboard
Future
Fetches the GUI settings of the vehicle. Returns a GuiSettings object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

GuiSettings guiSettings = await teslaAPI.vehicles.getGUISettings('your_vehicle_id_here');
copied to clipboard
Commands #
Future
Wakes up the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.wakeUp('your_vehicle_id_here');
copied to clipboard
Future
Unlocks the doors of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.unlockDoors('your_vehicle_id_here');
copied to clipboard
Future
Locks the doors of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.lockDoors('your_vehicle_id_here');
copied to clipboard
Future
Honks the horn of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.honkHorn('your_vehicle_id_here');
copied to clipboard
Future
Flashes the lights of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.flashLights('your_vehicle_id_here');
copied to clipboard
Future
Starts the Air Conditioning of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.startHVACSystem('your_vehicle_id_here');
copied to clipboard
Future
Stops the Air Conditioning of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.stopHVACSystem('your_vehicle_id_here');
copied to clipboard
Future
Sets the temperature of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.
driverTemp: The desired temperature for the driver in Celsius.
passengerTemp: The desired temperature for the passenger in Celsius.

ResponseModel response = await teslaAPI.vehicles.commands.setTemperature('your_vehicle_id_here', 22, 22);
copied to clipboard
Future
Sets the charge limit of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.
limit: The charge limit in percent.

ResponseModel response = await teslaAPI.vehicles.commands.setChargeLimit('your_vehicle_id_here', 80);
copied to clipboard
Future
Sets the charge limit of the vehicle to MAX. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.setMAXChargeLimit('your_vehicle_id_here');
copied to clipboard
Future
Sets the charge limit of the vehicle to Standard. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.setStandardChargeLimit('your_vehicle_id_here');
copied to clipboard
Future
Sets the state of the sunroof of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.
state: The desired SunRoofStates.

ResponseModel response = await teslaAPI.vehicles.commands.setSunRoof('your_vehicle_id_here', SunRoofStates.open);
copied to clipboard
Future
Opens or closes the trunk of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.openOrCloseTrunk('your_vehicle_id_here');
copied to clipboard
Future
Starts vehicle key-less driving mode. The vehicle must be placed in drive within 2 minutes of the response. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.
password: The password from my.teslamotors.com.

ResponseModel response = await teslaAPI.vehicles.commands.startRemoteDrive('your_vehicle_id_here', 'your_password_here');
copied to clipboard
Future
Opens vehicle charge port. Also unlocks the charge port if it is locked. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.openChargePort('your_vehicle_id_here');
copied to clipboard
Future
Closes the charge port of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.closeChargePort('your_vehicle_id_here');
copied to clipboard
Future
Starts vehicle charging. Vehicle must be plugged in, have power available, and not at charge limit. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.startCharging('your_vehicle_id_here');
copied to clipboard
Future
Stops vehicle charging. Vehicle must be charging. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.stopCharging('your_vehicle_id_here');
copied to clipboard
Future
Sets vehicle valet mode on or off with a PIN to disable it from within the car. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.
on: Valet Mode On or Off.
pin: The four-digit PIN.

ResponseModel response = await teslaAPI.vehicles.commands.setValetMode('your_vehicle_id_here', true, 1234);
copied to clipboard
Future
Resets vehicle valet PIN. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.resetValetPIN('your_vehicle_id_here');
copied to clipboard
Future
Activates the speed limit of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.activateSpeedLimit('your_vehicle_id_here');
copied to clipboard
Future
Deactivates the speed limit of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.deactivateSpeedLimit('your_vehicle_id_here');
copied to clipboard
Future
Sets the speed limit of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.setSpeedLimit('your_vehicle_id_here');
copied to clipboard
Future
Clears the speed limit PIN of the vehicle. Returns a ResponseModel object containing the data. Throws an `Exception if the request fails.
Parameters

id: The ID of the vehicle.

ResponseModel response = await teslaAPI.vehicles.commands.clearSpeedLimitPIN('your_vehicle_id_here');
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.