Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
stickpin committed Jun 17, 2024
1 parent 3aa16c8 commit 70c9cd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions volkswagencarnet/vw_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def configurate(self, miles=False, scandinavian_miles=False, **config):
self.unit = "l/100 mi"
self.convert = True
elif self.unit == "kWh/100 km":
self.unit = "kWh/100 mi"
self.unit = "mi/kWh"
self.convert = True
elif self.unit and scandinavian_miles:
if self.unit == "km":
Expand Down Expand Up @@ -194,8 +194,10 @@ def state(self):
if "mi" in self.unit:
if self.unit in ["mi", "mi/h"]:
return round(int(val) * 0.6213712)
if "gal/100 mi" in self.unit or "kWh/100 mi" in self.unit:
if "gal/100 mi" in self.unit:
return round(val * 0.4251438, 1)
if "mi/kWh" in self.unit:
return round((100 / val) * 0.6213712, 1)
if "°F" in self.unit:
return round((val * 9 / 5) + 32, 1)
if self.unit in ["mil", "mil/h"]:
Expand Down

0 comments on commit 70c9cd0

Please sign in to comment.