diff --git a/AUTHORS b/AUTHORS index fad5e7e..5c174f4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,4 +11,5 @@ * is00709 @is00709 * Gregor Wolf @gregorwolf * Max Dhom @mdhom -* Torben Nehmer @torbennehmer \ No newline at end of file +* Torben Nehmer @torbennehmer +* Kristian Lorbetzki @lorbetzki \ No newline at end of file diff --git a/README.md b/README.md index a7d2153..1da810c 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,7 @@ Poll returns a dictionary like the following: - `set_power_limits()` - `set_powersave()` - `set_wallbox_max_charge_current()` +- `set_wallbox_min_charge_current()` - `set_wallbox_schuko()` - `set_wallbox_sunmode()` - `set_weather_regulated_charge()` diff --git a/e3dc/__init__.py b/e3dc/__init__.py index c851c82..260e0ab 100644 --- a/e3dc/__init__.py +++ b/e3dc/__init__.py @@ -26,4 +26,4 @@ "RscpMessage", "set_rscp_debug", ] -__version__ = "0.10.0" +__version__ = "0.10.1" diff --git a/e3dc/_e3dc.py b/e3dc/_e3dc.py index 2a891c0..ed96ea2 100644 --- a/e3dc/_e3dc.py +++ b/e3dc/_e3dc.py @@ -1030,6 +1030,7 @@ def get_wallbox_data(self, wbIndex: int = 0, keepAlive: bool = False): "index": , "keyState": , "maxChargeCurrent": , + "minChargeCurrent": , "phases": , "schukoOn": , "soc": , @@ -1047,6 +1048,7 @@ def get_wallbox_data(self, wbIndex: int = 0, keepAlive: bool = False): (RscpTag.WB_REQ_EXTERN_DATA_NET, RscpType.NoneType, None), (RscpTag.WB_REQ_APP_SOFTWARE, RscpType.NoneType, None), (RscpTag.WB_REQ_KEY_STATE, RscpType.NoneType, None), + (RscpTag.WB_REQ_MIN_CHARGE_CURRENT, RscpType.NoneType, None), ], ), keepAlive=True, @@ -1089,7 +1091,12 @@ def get_wallbox_data(self, wbIndex: int = 0, keepAlive: bool = False): key_state = rscpFindTag(req, RscpTag.WB_KEY_STATE) if key_state is not None: outObj["keyState"] = rscpFindTagIndex(key_state, RscpTag.WB_KEY_STATE) - + + min_charge_current = rscpFindTag(req, RscpTag.WB_MIN_CHARGE_CURRENT) + if min_charge_current is not None and min_charge_current[1] != RscpType.Error.name: + outObj["minChargeCurrent"] = rscpFindTagIndex( + min_charge_current, RscpTag.WB_MIN_CHARGE_CURRENT + ) req = self.sendRequest( (RscpTag.EMS_REQ_BATTERY_TO_CAR_MODE, RscpType.NoneType, None), keepAlive=keepAlive, @@ -1160,7 +1167,42 @@ def set_wallbox_max_charge_current( wbIndex=wbIndex, keepAlive=keepAlive, ) + + def set_wallbox_min_charge_current( + self, min_charge_current: int, wbIndex: int = 0, keepAlive: bool = False + ) -> bool: + """Sets the minimum charge current of the wallbox via rscp protocol locally. + + Args: + min_charge_current (int): minimum allowed charge current in A + wbIndex (int | None): index of the requested wallbox, + keepAlive (bool | None): True to keep connection alive + Returns: + True if success + False if error + """ + response = self.sendRequest( + ( + RscpTag.WB_REQ_DATA, + RscpType.Container, + [ + (RscpTag.WB_INDEX, RscpType.UChar8, wbIndex), + ( + RscpTag.WB_REQ_SET_MIN_CHARGE_CURRENT, + RscpType.Int32, + min_charge_current, + ), + ], + ), + keepAlive=keepAlive, + ) + + if response[0] != RscpTag.WB_DATA.name: + return False + responseData = response[2][-1] + return responseData[1] != RscpType.Error.name + def toggle_wallbox_charging( self, wbIndex: int = 0, keepAlive: bool = False ) -> bool: