Package de.chiflux.tesla
Class TeslaApiService
java.lang.Object
de.chiflux.tesla.TeslaApiService
- All Implemented Interfaces:
TeslaApi
Service Monitoring of all assigned vehicles of a tesla account.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SynchronousQueue<StateChangeInfo>Synchronous queue to safely exchange state change events over thread boundaries. -
Method Summary
Modifier and TypeMethodDescriptionvoidEnds the monitoring service (cannot be restarted afterward)Full vehicle data consists of charge state, drive state, vehicle config vehicle state and general information.static TeslaApiServiceGet the instanceAll vehicles associated with the accountbooleanTests if a car is mute i.e., it will not query the vehicle data API to give the vehicle a chance to fall asleep.voidWill let a vehicle fall asleepvoidPauses the monitoring servicevoidRefresh the access token.setChargeLimit(String id_s, int chargeLimit) Set the charge limitstartCharge(String id_s) Start chargingvoidStarts the monitoring servicestopCharge(String id_s) Stop chargingvoidunmuteVehicle(String id_s) Allow requesting the vehicle data APIWake up the vehicle
-
Field Details
-
STATE_CHANGE_INFO_QUEUE
Synchronous queue to safely exchange state change events over thread boundaries.
-
-
Method Details
-
getInstance
Get the instance- Returns:
- the instance
-
markVehicleInactive
Will let a vehicle fall asleep- Parameters:
id- the vehicle id
-
unmuteVehicle
Allow requesting the vehicle data API- Parameters:
id_s- id of the vehicle
-
isMute
Tests if a car is mute i.e., it will not query the vehicle data API to give the vehicle a chance to fall asleep.- Parameters:
id_s- id of the vehicle- Returns:
- true if vehicle is mute
-
startService
public void startService()Starts the monitoring service -
pauseService
public void pauseService()Pauses the monitoring service -
endService
public void endService()Ends the monitoring service (cannot be restarted afterward) -
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- 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
-