Skip to content

Commit

Permalink
Merge pull request #224 from itchannel/1.40
Browse files Browse the repository at this point in the history
1.40
  • Loading branch information
itchannel authored Dec 7, 2022
2 parents 9a2b791 + a3214ba commit 2c71af9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/combined.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: HACS
steps:
- name: Check out the repository
uses: "actions/checkout@v3.0.2"
uses: "actions/checkout@v3"

- name: HACS validation
uses: "hacs/[email protected]"
Expand All @@ -22,7 +22,7 @@ jobs:
name: Hassfest
steps:
- name: Check out the repository
uses: "actions/checkout@v3.0.2"
uses: "actions/checkout@v3"

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
2 changes: 1 addition & 1 deletion custom_components/fordpass/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
CONF_PRESSURE_UNIT = "pressure_unit"
CONF_DISTANCE_UNIT = "distance_unit"

PRESSURE_UNITS = ["PSI", "kPa"]
PRESSURE_UNITS = ["PSI", "kPa", "BAR"]
DISTANCE_UNITS = ["mi", "km"]

UPDATE_INTERVAL = "update_interval"
Expand Down
3 changes: 2 additions & 1 deletion custom_components/fordpass/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"domain": "fordpass",
"name": "FordPass",
"config_flow": true,
"integration_type": "device",
"documentation": "https://github.com/itchannel/fordpass-ha",
"issue_tracker": "https://github.com/itchannel/fordpass-ha/issues",
"version": "0.1.39",
"version": "0.1.40",
"requirements": [],
"ssdp": [],
"zeroconf": [],
Expand Down
23 changes: 15 additions & 8 deletions custom_components/fordpass/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def get_value(self, ftype):
/ 1.60934
)
else:
return self.coordinator.data["elVehDTE"]["value"]
return float(self.coordinator.data["elVehDTE"]["value"])
else:
return self.coordinator.data["elVehDTE"]["value"]
return float(self.coordinator.data["elVehDTE"]["value"])
else:
return "Unsupported"
elif self.sensor == "zoneLighting":
Expand Down Expand Up @@ -206,16 +206,22 @@ def get_value(self, ftype):
if self.options[CONF_PRESSURE_UNIT] == "PSI":
sval = 0.1450377377
rval = 1
decimal = 0
if self.options[CONF_PRESSURE_UNIT] == "BAR":
sval = 0.01
rval = 0.0689475729
decimal = 2
else:
sval = 1
rval = 6.8947572932
decimal = 0
tirepress = {}
for key, value in self.coordinator.data["TPMS"].items():
if "TirePressure" in key and value is not None:
if "TirePressure" in key and value is not None and value is not '':
if "recommended" in key:
tirepress[key] = round(float(value["value"]) * rval)
tirepress[key] = round(float(value["value"]) * rval, decimal)
else:
tirepress[key] = round(float(value["value"]) * sval)
tirepress[key] = round(float(value["value"]) * sval, decimal)
return tirepress
return None
elif self.sensor == "gps":
Expand Down Expand Up @@ -297,9 +303,9 @@ def get_value(self, ftype):
self.coordinator.data["batteryFillLevel"] != None
and self.coordinator.data["batteryFillLevel"]["value"] != None
):
elecs["Battery Fill Level"] = self.coordinator.data[
elecs["Battery Fill Level"] = int(self.coordinator.data[
"batteryFillLevel"
]["value"]
]["value"])

if (
self.coordinator.data["chargerPowertype"] != None
Expand Down Expand Up @@ -348,7 +354,8 @@ def get_value(self, ftype):
for key, value in self.coordinator.data[self.sensor][
"lightSwitchStatusData"
].items():
zone[key] = value["value"]
if value is not None:
zone[key] = value["value"]

if (
self.coordinator.data[self.sensor]["zoneLightingFaultStatus"]
Expand Down
5 changes: 5 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

## **Changelog**
### Version 1.40
- Fix empty value bug for lighting attributes
- Fix casting bug for elvehdte and batterly level
- Fix empty but not null string for tire pressure
- Add BAR units to options
### Version 1.39
- added statistics support to odometer sensor
- Fixed device_tracker not working correctly in automations
Expand Down

0 comments on commit 2c71af9

Please sign in to comment.