Skip to content

Commit

Permalink
tesla_api: handle case where user hasn't named the car yet
Browse files Browse the repository at this point in the history
  • Loading branch information
marcone committed Apr 4, 2024
1 parent d34b3f5 commit 08f0370
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions run/tesla_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ def _get_id():
# Call list_vehicles() and use the provided name or VIN to get the vehicle ID.
result = list_vehicles()
for vehicle_dict in result['response']:
if ( vehicle_dict['vin'] == SETTINGS['tesla_vin']
or vehicle_dict['display_name'] == SETTINGS['tesla_name']
if ( ( SETTINGS['tesla_vin'] != '' && vehicle_dict['vin'] == SETTINGS['tesla_vin'] )
or ( SETTINGS['tesla_name'] != '' && vehicle_dict['display_name'] == SETTINGS['tesla_name'] )
or ( SETTINGS['tesla_vin'] == '' and SETTINGS['tesla_name'] == '')):
tesla_api_json['id'] = vehicle_dict['id_s']
tesla_api_json['vehicle_id'] = vehicle_dict['vehicle_id']
Expand Down

0 comments on commit 08f0370

Please sign in to comment.