Package de.chiflux.tesla
Class TeslaLiveApi
java.lang.Object
de.chiflux.tesla.TeslaLiveApi
- All Implemented Interfaces:
TeslaApi
A thin wrapper around the Tesla API functionality supporting charging.
It makes use of these APIs:
/api/1/vehicles, /ID/vehicle_data, /ID/wake_up, /ID/command/set_charge_limit, /ID/command/charge_*
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor which reads TESLA_REFRESH_TOKEN from Java Properties or ENV Variable.TeslaLiveApi(String teslaRefreshToken) Explicit constructor that takes the TESLA_REFRESH_TOKEN as parameter. -
Method Summary
Modifier and TypeMethodDescriptiongetFullVehicleData(String id_s) Full vehicle data consists of charge state, drive state, vehicle config vehicle state and general information.All vehicles associated with the accountvoidRefresh the access token.setChargeLimit(String id_s, int chargeLimit) Set the charge limitstartCharge(String id_s) Start chargingstopCharge(String id_s) Stop chargingWake up the vehicle
-
Constructor Details
-
TeslaLiveApi
Explicit constructor that takes the TESLA_REFRESH_TOKEN as parameter.- Parameters:
teslaRefreshToken- The TESLA_REFRESH_TOKEN as parameter - must not be null
-
TeslaLiveApi
public TeslaLiveApi()Default constructor which reads TESLA_REFRESH_TOKEN from Java Properties or ENV Variable. A Java Property has precedence over an ENV variable.
-
-
Method Details
-
startCharge
Description copied from interface:TeslaApiStart charging- Specified by:
startChargein interfaceTeslaApi- Parameters:
id_s- id of the vehicle- Returns:
- true if successful
-
stopCharge
Description copied from interface:TeslaApiStop charging- Specified by:
stopChargein interfaceTeslaApi- Parameters:
id_s- id of the vehicle- Returns:
- true if successful
-
setChargeLimit
Description copied from interface:TeslaApiSet the charge limit- Specified by:
setChargeLimitin interfaceTeslaApi- Parameters:
id_s- id of the vehiclechargeLimit- charge limit in percent- Returns:
- true if successful
-
wakeUp
Description copied from interface:TeslaApiWake up the vehicle -
getFullVehicleData
Description copied from interface:TeslaApiFull vehicle data consists of charge state, drive state, vehicle config vehicle state and general information. Should implement a grace period if the vehicle is parked and locked to give the vehicle a change to sleep.- Specified by:
getFullVehicleDatain interfaceTeslaApi- Parameters:
id_s- id of the vehicle- Returns:
- Full vehicle data or null
-
getVehicles
Description copied from interface:TeslaApiAll vehicles associated with the account- Specified by:
getVehiclesin interfaceTeslaApi- Returns:
- All vehicles associated with the account or null
-
refreshToken
public void refreshToken()Description copied from interface:TeslaApiRefresh the access token.- Specified by:
refreshTokenin interfaceTeslaApi
-