Skip to content

Commit

Permalink
Added the customMetrics score keys under elVeh, should not show up fo…
Browse files Browse the repository at this point in the history
…r non EV's. Updated info.md
  • Loading branch information
SquidBytes committed Oct 27, 2023
1 parent c5b5944 commit 0b54dd0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions custom_components/fordpass/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,18 @@ def get_value(self, ftype):
if "tripXevBatteryRangeRegenerated" in self.data:
elecs["Trip Range Regenerated"] = self.units.length(self.data.get("tripXevBatteryRangeRegenerated", {}).get("value", 0),UnitOfLength.KILOMETERS)

if "customMetrics" in self.data and "xevBatteryCapacity" in self.data:
for key in self.data.get("customMetrics", {}):
if "accumulated-vehicle-speed-cruising-coaching-score" in key:
elecs["Trip Speed Score"] = self.data.get("customMetrics", {}).get(key, {}).get("value")
if "accumulated-deceleration-coaching-score" in key:
elecs["Trip Deceleration Score"] = self.data.get("customMetrics", {}).get(key, {}).get("value")
if "accumulated-acceleration-coaching-score" in key:
elecs["Trip Acceleration Score"] = self.data.get("customMetrics", {}).get(key, {}).get("value")
if "custom:vehicle-electrical-efficiency" in key:
# Still don't know what this value is, but if I add it and get more data it could help to figure it out
elecs["Trip Electrical Efficiency"] = self.data.get("customMetrics", {}).get(key, {}).get("value")

if "customEvents" in self.events:
tripDataStr = self.events.get("customEvents", {}).get("xev-key-off-trip-segment-data", {}).get("oemData", {}).get("trip_data", {}).get("stringArrayValue", [])
for dataStr in tripDataStr:
Expand Down
7 changes: 6 additions & 1 deletion info.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
- Compass Direction is now an attribute under the device_tracker entity
- Handle missing countdownTimer variable
- Handle missing events dictionary
- Temporary fix for elveh errors
- Temporary fix for elveh errors
- Added more Trip Data to elVeh (will asses to determine if previous Trip scores can be removed)
- Trip Speed Score
- Trip Deceleration Score
- Trip Acceleration Score
- Trip Electrical Efficiency (unsure what this value is, adding it to get more data)
### Version 1.60
- Versioning issue 1.59 is 1.60
### Version 1.59
Expand Down

0 comments on commit 0b54dd0

Please sign in to comment.