Skip to content

Commit

Permalink
Ensure there is always a vehicle name [closes #24]
Browse files Browse the repository at this point in the history
Possibly also #25
  • Loading branch information
jhansche committed Apr 6, 2024
1 parent 55fe523 commit 770a634
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions custom_components/teslafi/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ def firmware_version(self) -> str | None:
return self.get("car_version", None)

@property
def name(self) -> str | None:
def name(self) -> str:
"""Vehicle display name"""
return self.get("display_name")
return (
self.get("display_name", None)
# 2018 model3 <last-4-vin>
or f"{self.model_year} {self.car_type} {self.vin[-4:]}"
)

@property
def car_type(self) -> str | None:
Expand Down

0 comments on commit 770a634

Please sign in to comment.