srwalter / garmin-tesla

ConnectIQ widget for Tesla vehicle control
32 stars 17 forks source link

fix: get the vehicle name from the vehicle_state #43

Open bdo opened 9 months ago

bdo commented 9 months ago

Tesla removed the display_name property from the vehicle_data response. It is now found under under vehicle_state subsection of the vehicle_data response.

This PR addresses this issue.

Tests

Fixes #42

Before the fix

image

Error: Unhandled Exception
Exception: UnexpectedTypeException: Expected Number/Float/Boolean/Long/Double, given null
Stack: 
  - setText() at 704b03c0.mb:5530 0x300043fd 
  - onUpdate() at /Users/bdoncieu/projects/garmin-tesla/source/MainView.mc:115 0x1000122f 

Encountered app crash.

After the fix

image