Skip to content

Commit

Permalink
Add support of mileage_CAN parameter
Browse files Browse the repository at this point in the history
Mileage_CAN will be used if supported.
  • Loading branch information
turbulator committed Oct 16, 2020
1 parent 65f49ca commit fb695ac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions custom_components/pandora_cas/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ def fuel_tank(self) -> int:
"""Get the capacity of fuel tank."""
return int(self._info["fuel_tank"])

@property
def mileage(self) -> float:
"""Get the mileage."""

# mileage_CAN will be used if supported
if self._attributes["mileage_CAN"] > 0:
return float(self._attributes["mileage_CAN"])

return float(self._attributes["mileage"])

@property
def device_info(self) -> dict:
"""Unified device info dictionary."""
Expand Down

0 comments on commit fb695ac

Please sign in to comment.