A multi-platform Tesla API Client Library for Kotlin and Java.
dependencies {
implementation("org.teslatoolkit:tesla-core:0.1.0")
}
- Authentication
- Email/Password
- OAuth2 Token
- Read Access
- Vehicles on Account
- Climate State
- Drive State
- Media State
- Charge State
- Vehicle Configuration
- GUI Settings
suspend fun main() {
val client = TeslaHttpClient.create(
AccountAuthentication(
email = "[email protected]",
password = "MySecurePassword"
)
)
client.listVehicles().forEach { vehicle ->
println("Vehicle ${vehicle.vehicleId}:")
println(" State: ${vehicle.state}")
}
client.close()
}
class ExampleMain {
public static void main(String[] args){
AuthenticationMethod auth = new AccountAuthentication(args[0], args[1]);
try (TeslaClientSync client = TeslaClientSync.create(auth)) {
for (Vehicle vehicle : client.listVehicles()) {
System.out.println("Vehicle " + vehicle.getVehicleId());
System.out.println(" State: " + vehicle.getState());
}
}
}
}