diff --git a/custom_components/fordpass/const.py b/custom_components/fordpass/const.py index c48ef9f..da5d084 100644 --- a/custom_components/fordpass/const.py +++ b/custom_components/fordpass/const.py @@ -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": { @@ -80,11 +83,6 @@ }, } -SWITCHES = { - "ignition": {"icon": "hass:power"}, - # "guardmode": {"icon": "mdi:shield-key"} -} - REGIONS = { "UK&Europe": { "region": "1E8C7794-FF5F-49BC-9596-A1E0C86C5B19", diff --git a/custom_components/fordpass/sensor.py b/custom_components/fordpass/sensor.py index b582fbc..0d952a6 100644 --- a/custom_components/fordpass/sensor.py +++ b/custom_components/fordpass/sensor.py @@ -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 diff --git a/info.md b/info.md index fd9a7a7..416a6e5 100644 --- a/info.md +++ b/info.md @@ -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