From 07a213c0d5a43257d037f7584b8c2c88af053afe Mon Sep 17 00:00:00 2001 From: asychow Date: Sun, 17 Nov 2024 16:22:50 +0000 Subject: [PATCH] feat: EV charging speed in EU and fix for US (#684) --- hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py | 4 ++-- hyundai_kia_connect_api/KiaUvoApiEU.py | 5 +++++ hyundai_kia_connect_api/Vehicle.py | 3 ++- hyundai_kia_connect_api/bluelink.py | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py b/hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py index 2aa9c0f1..d0b96ca1 100644 --- a/hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py +++ b/hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py @@ -386,8 +386,8 @@ def _update_vehicle_properties(self, vehicle: Vehicle, state: dict) -> None: vehicle.ev_battery_is_plugged_in = get_child_value( state, "vehicleStatus.evStatus.batteryPlugin" ) - vehicle.ev_charging_current = get_child_value( - state, "vehicleStatus.evStatus.batteryStndChrgPower" + vehicle.ev_charging_power = get_child_value( + state, "vehicleStatus.evStatus.batteryPower.batteryStndChrgPower" ) ChargeDict = get_child_value( state, "vehicleStatus.evStatus.reservChargeInfos.targetSOClist" diff --git a/hyundai_kia_connect_api/KiaUvoApiEU.py b/hyundai_kia_connect_api/KiaUvoApiEU.py index 9da0e574..ba2be6e2 100644 --- a/hyundai_kia_connect_api/KiaUvoApiEU.py +++ b/hyundai_kia_connect_api/KiaUvoApiEU.py @@ -520,6 +520,11 @@ def _update_vehicle_properties(self, vehicle: Vehicle, state: dict) -> None: vehicle.ev_charge_port_door_is_open = True elif ev_charge_port_door_is_open == 2: vehicle.ev_charge_port_door_is_open = False + + vehicle.ev_charging_power = get_child_value( + state, "vehicleStatus.evStatus.batteryPower.batteryStndChrgPower" + ) + if ( get_child_value( state, diff --git a/hyundai_kia_connect_api/Vehicle.py b/hyundai_kia_connect_api/Vehicle.py index 23cdab58..fa9d2731 100644 --- a/hyundai_kia_connect_api/Vehicle.py +++ b/hyundai_kia_connect_api/Vehicle.py @@ -156,11 +156,12 @@ class Vehicle: # EV fields (EV/PHEV) ev_charge_port_door_is_open: typing.Union[bool, None] = None + ev_charging_power: typing.Union[float, None] = None # Charging power in kW ev_charge_limits_dc: typing.Union[int, None] = None ev_charge_limits_ac: typing.Union[int, None] = None ev_charging_current: typing.Union[int, None] = ( - None # Only supported in some regions + None # Europe feature only, ac charging current limit ) ev_v2l_discharge_limit: typing.Union[int, None] = None diff --git a/hyundai_kia_connect_api/bluelink.py b/hyundai_kia_connect_api/bluelink.py index e393291a..afd6bcc2 100755 --- a/hyundai_kia_connect_api/bluelink.py +++ b/hyundai_kia_connect_api/bluelink.py @@ -100,6 +100,7 @@ def print_vehicle(vehicle): print(" location_last_updated_at:", vehicle.location_last_updated_at) print("EV/PHEV") print(" charge_port_door_is_open:", vehicle.ev_charge_port_door_is_open) + print(" charging_power:", vehicle.ev_charging_power) print(" charge_limits_dc:", vehicle.ev_charge_limits_dc) print(" charge_limits_ac:", vehicle.ev_charge_limits_ac) print(" charging_current:", vehicle.ev_charging_current) @@ -278,6 +279,7 @@ def vehicle_to_dict(vehicle): }, "electric": { "charge_port_door_is_open": vehicle.ev_charge_port_door_is_open, + "charging_power": vehicle.ev_charging_power, "charge_limits_dc": vehicle.ev_charge_limits_dc, "charge_limits_ac": vehicle.ev_charge_limits_ac, "charging_current": vehicle.ev_charging_current,