Skip to content

Commit

Permalink
feat(EU): Support setting the charging current (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrnk authored Jun 24, 2024
1 parent 0e59a14 commit 632951f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hyundai_kia_connect_api/ApiImpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ def set_charge_limits(
"""Sets charge limits. Returns the tracking ID"""
pass

def set_charging_current(self, token: Token, vehicle: Vehicle, level: int) -> str:
"""Sets charge current level (1=100%, 2=90%, 3=60%). Returns the tracking ID"""
pass

def set_windows_state(
self, token: Token, vehicle: Vehicle, options: WindowRequestOptions
) -> str:
Expand Down
3 changes: 3 additions & 0 deletions hyundai_kia_connect_api/ApiImplType1.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ def _update_vehicle_properties_ccs2(self, vehicle: Vehicle, state: dict) -> None
vehicle.ev_charge_limits_dc = get_child_value(
state, "Green.ChargingInformation.TargetSoC.Quick"
)
vehicle.ev_charging_current = get_child_value(
state, "Green.ChargingInformation.ElectricCurrentLevel.State"
)
vehicle.ev_v2l_discharge_limit = get_child_value(
state, "Green.Electric.SmartGrid.VehicleToLoad.DischargeLimitation.SoC"
)
Expand Down
17 changes: 17 additions & 0 deletions hyundai_kia_connect_api/KiaUvoApiEU.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,23 @@ def set_charge_limits(
_check_response_for_errors(response)
return response["msgId"]

def set_charging_current(self, token: Token, vehicle: Vehicle, level: int) -> str:
url = (
self.SPA_API_URL + "vehicles/" + vehicle.id + "/ccs2/charge/chargingcurrent"
)

body = {"chargingCurrent": level}
response = requests.post(
url,
json=body,
headers=self._get_authenticated_headers(
token, vehicle.ccu_ccs2_protocol_support
),
).json()
_LOGGER.debug(f"{DOMAIN} - Set Charging Current Response: {response}")
_check_response_for_errors(response)
return response["msgId"]

def schedule_charging_and_climate(
self,
token: Token,
Expand Down
1 change: 1 addition & 0 deletions hyundai_kia_connect_api/Vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class Vehicle:

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 # Europe feature only
ev_v2l_discharge_limit: typing.Union[int, None] = None

# energy consumed and regenerated since the vehicle was paired with the account
Expand Down

0 comments on commit 632951f

Please sign in to comment.