Skip to content

Commit

Permalink
Merge pull request #232 from itchannel/1.41
Browse files Browse the repository at this point in the history
rename options to fordoptions
  • Loading branch information
itchannel committed Jan 1, 2023
2 parents 2c71af9 + a630266 commit 1ae7458
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion custom_components/fordpass/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"integration_type": "device",
"documentation": "https://github.com/itchannel/fordpass-ha",
"issue_tracker": "https://github.com/itchannel/fordpass-ha/issues",
"version": "0.1.40",
"version": "0.1.41",
"requirements": [],
"ssdp": [],
"zeroconf": [],
Expand Down
18 changes: 9 additions & 9 deletions custom_components/fordpass/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CarSensor(
def __init__(self, coordinator, sensor, options):

self.sensor = sensor
self.options = options
self.fordoptions = options
self._attr = {}
self.coordinator = coordinator
self._device_id = "fordpass_" + sensor
Expand All @@ -52,8 +52,8 @@ def __init__(self, coordinator, sensor, options):
def get_value(self, ftype):
if ftype == "state":
if self.sensor == "odometer":
if self.options[CONF_DISTANCE_UNIT] != None:
if self.options[CONF_DISTANCE_UNIT] == "mi":
if self.fordoptions[CONF_DISTANCE_UNIT] != None:
if self.fordoptions[CONF_DISTANCE_UNIT] == "mi":
return round(
float(self.coordinator.data[self.sensor]["value"]) / 1.60934
)
Expand Down Expand Up @@ -107,8 +107,8 @@ def get_value(self, ftype):
)
elif self.sensor == "elVeh":
if self.coordinator.data["elVehDTE"] != None:
if self.options[CONF_DISTANCE_UNIT] != None:
if self.options[CONF_DISTANCE_UNIT] == "mi":
if self.fordoptions[CONF_DISTANCE_UNIT] != None:
if self.fordoptions[CONF_DISTANCE_UNIT] == "mi":
return round(
float(self.coordinator.data["elVehDTE"]["value"])
/ 1.60934
Expand Down Expand Up @@ -146,7 +146,7 @@ def get_value(self, ftype):
return len(self.coordinator.data["messages"])
elif ftype == "measurement":
if self.sensor == "odometer":
if self.options[CONF_DISTANCE_UNIT] == "mi":
if self.fordoptions[CONF_DISTANCE_UNIT] == "mi":
return "mi"
else:
return "km"
Expand Down Expand Up @@ -186,7 +186,7 @@ def get_value(self, ftype):
elif self.sensor == "fuel":
if self.coordinator.data[self.sensor] == None:
return None
if self.options[CONF_DISTANCE_UNIT] == "mi":
if self.fordoptions[CONF_DISTANCE_UNIT] == "mi":
self.coordinator.data["fuel"]["distanceToEmpty"] = round(
float(self.coordinator.data["fuel"]["distanceToEmpty"])
/ 1.60934
Expand All @@ -203,11 +203,11 @@ def get_value(self, ftype):
elif self.sensor == "tirePressure":
if self.coordinator.data["TPMS"] != None:

if self.options[CONF_PRESSURE_UNIT] == "PSI":
if self.fordoptions[CONF_PRESSURE_UNIT] == "PSI":
sval = 0.1450377377
rval = 1
decimal = 0
if self.options[CONF_PRESSURE_UNIT] == "BAR":
if self.fordoptions[CONF_PRESSURE_UNIT] == "BAR":
sval = 0.01
rval = 0.0689475729
decimal = 2
Expand Down
2 changes: 2 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

## **Changelog**
### Version 1.41
- Fix options error in HA 2023
### Version 1.40
- Fix empty value bug for lighting attributes
- Fix casting bug for elvehdte and batterly level
Expand Down

0 comments on commit 1ae7458

Please sign in to comment.