-
Notifications
You must be signed in to change notification settings - Fork 0
/
TeslaInfo.py
32 lines (24 loc) · 929 Bytes
/
TeslaInfo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import argparse
import getpass
from teslapy import Product, Tesla, Vehicle
def main():
parser = argparse.ArgumentParser(description='Tesla Info CLI')
parser.add_argument('-u', dest='email', help='login email', required=True)
parser.add_argument('-p', dest='password', help='login password')
args = parser.parse_args()
if args.password == None:
password = getpass.getpass('Password: ')
else:
password = args.password
with Tesla(args.email, password) as tesla:
tesla.fetch_token()
selected = tesla.vehicle_list()
for i, product in enumerate(selected):
print('product %d:' % i)
product.sync_wake_up()
# print(product)
# print(product.decode_vin())
print(product.get_vehicle_data()) #sync_wake_up is required
# print(product.get_vehicle_summary())
if __name__ == "__main__":
main()