特斯拉API客户端
tesla-client的Python项目详细描述
特斯拉客户
此库允许访问非官方的tesla api,以读取数据并向tesla车辆发出命令。
这个库的一个关键特性是它提供了一种简单的方法,可以将OAuth凭据与您选择的数据存储同步凭据在登录时或令牌刷新期间自动保存。
快速启动
import tesla_client tesla_client.init(CLIENT_ID, CLIENT_SECRET) # Get these values from https://pastebin.com/pS7Z6yyP # Define an Account subclass of your own to manage OAuth credential storage class MyTeslaAccount(tesla_client.Account): def get_credentials(self): return your_credentials_store.get() def save_credentials(self, creds): your_credentials_store.save(creds) account = MyTeslaAccount() # Log in (and automatically save the OAuth credentials) account.login('mrsteven@gmail.com', 'password') # Access a vehicle in this account vehicle = account.get_vehicles()[0] # Fetch some data from the vehicle vehicle.data_request('drive_state') # Send a command to the vehicle vehicle.command('honk_horn')
特斯拉API没有得到特斯拉公司的官方支持。它可能随时停止工作有关api命令的详细文档,请参见https://tesla-api.timdorr.com/。感谢Tim Dorr在记录非官方API方面所做的工作
Tesla,Inc.不认可或支持此Python库。