Skip to content

Commit

Permalink
Clean up CarBrands enum
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe committed Jul 1, 2024
1 parent ae5a976 commit bb7cff2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions bimmer_connected/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ async def _init_vehicles(self) -> None:
)
vehicle_profile = vehicle_profile_response.json()

# Special handling for DRITTKUNDE (third party custome) aka Toyota Supra.
# Requires TOYOTA in request, but returns DRITTKUNDE in response.
if brand == CarBrands.TOYOTA:
vehicle_profile["brand"] = CarBrands.TOYOTA.value.upper()

vehicle_base = dict(
{ATTR_ATTRIBUTES: {k: v for k, v in vehicle_profile.items() if k != "vin"}},
**{"vin": vehicle_profile["vin"]}
Expand Down
3 changes: 0 additions & 3 deletions bimmer_connected/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ def _missing_(cls, value):
for member in cls:
if member.value == value.lower():
return member
# The API request needs to be "toyota" but the API response value is "drittkunde" ("third party vendor")
if value.lower() == "drittkunde":
return cls.TOYOTA
raise ValueError(f"'{value}' is not a valid {cls.__name__}")

BMW = "bmw"
Expand Down

0 comments on commit bb7cff2

Please sign in to comment.