Skip to content

Commit

Permalink
Merge pull request #493 from itchannel/1.68
Browse files Browse the repository at this point in the history
1.68
  • Loading branch information
itchannel authored May 9, 2024
2 parents ba3e989 + f14bfee commit 1b78438
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 5 additions & 7 deletions custom_components/fordpass/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@
"events": {"icon": "mdi:calendar", "api_key": "events", "sensor_type": "single", "debug": True},
"metrics": {"icon": "mdi:chart-line", "api_key": "metrics", "sensor_type": "single", "debug": True},
"states": {"icon": "mdi:car", "api_key": "states", "sensor_type": "single", "debug": True},
"vehicles": {"icon": "mdi:car-multiple", "api_key": "vehicles", "sensor_type": "single", "debug": True},
"vehicles": {"icon": "mdi:car-multiple", "api_key": "vehicles", "sensor_type": "single", "debug": True}
}

SWITCHES = {"ignition": {"icon": "hass:power"}, "guardmode": {"icon": "mdi:shield-key"}}
SWITCHES = {
"ignition": {"icon": "hass:power"},
#"guardmode": {"icon": "mdi:shield-key"}
}

WINDOW_POSITIONS = {
"CLOSED": {
Expand All @@ -80,11 +83,6 @@
},
}

SWITCHES = {
"ignition": {"icon": "hass:power"},
# "guardmode": {"icon": "mdi:shield-key"}
}

REGIONS = {
"UK&Europe": {
"region": "1E8C7794-FF5F-49BC-9596-A1E0C86C5B19",
Expand Down
9 changes: 9 additions & 0 deletions custom_components/fordpass/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,17 @@ def get_value(self, ftype):

# Returning 0 in else - to prevent attribute from not displaying
if "xevBatteryChargerVoltageOutput" in self.data and "xevBatteryChargerCurrentOutput" in self.data:

# Get Battery Io Current for DC Charging calculation
if "xevBatteryIoCurrent" in self.data:
batt_amps = float(self.data.get("xevBatteryIoCurrent", {}).get("value", 0))

# AC Charging calculation
if ch_volt != 0 and ch_amps != 0:
cs["Charging kW"] = round((ch_volt * ch_amps) / 1000, 2)
# DC Charging calculation: Use absolute value for amperage to handle negative values
elif ch_volt != 0 and batt_amps != 0:
cs["Charging kW"] = round((ch_volt * abs(batt_amps)) / 1000, 2)
else:
cs["Charging kW"] = 0

Expand Down
2 changes: 2 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## **Changelog**
### Version 1.68
- Fix for missing locale
- Fix duplicate Switches dictionary
- Fix DC fast charging bug
### Version 1.67
- Temp fix for login issues (Uses different region login servers, may get blocked soon!)
### Version 1.66
Expand Down

0 comments on commit 1b78438

Please sign in to comment.