diff --git a/.gitignore b/.gitignore index e7d52ec..0e5a5bc 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,6 @@ dmypy.json test_liviu.py APIDEBUG.md .DS_Store + +# PyCharm +.idea/ \ No newline at end of file diff --git a/README.md b/README.md index dc9f376..dc6cd3e 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,14 @@ pip install wallbox - a full charger reboot can take a few minutes. Charger status will be slow to update (ie: READY (10s) -> DISCONNECTED (90s) -> READY) CAUTION: use this method with care!! Check if the charger is not in the middle of a firmware upgrade as this can brick your charger. + +### setIcpMaxCurrent(chargerId, newIcpMaxCurrentValue) + +- sets charger Maximum ICP Current available (Amps). + +Please note that the wallbox may refuse this action if not setup properly of if not supported by your model + + ### getChargerSchedules(chargerId) - gets the currently configured schedules for that charger. diff --git a/wallbox/wallbox.py b/wallbox/wallbox.py index 354cafe..342a20a 100644 --- a/wallbox/wallbox.py +++ b/wallbox/wallbox.py @@ -202,6 +202,14 @@ def setEnergyCost(self, chargerId, energyCost): raise (err) return json.loads(response.text) + + def setIcpMaxCurrent(self, chargerId, newIcpMaxCurrentValue): + try: + response = requests.post( + f"{self.baseUrl}chargers/config/{chargerId}", + headers=self.headers, + json={'icp_max_current': newIcpMaxCurrentValue}, + def getChargerSchedules(self, chargerId): try: response = requests.get( @@ -213,25 +221,6 @@ def getChargerSchedules(self, chargerId): raise (err) return json.loads(response.text) - """ - Example request: - { - 'schedules': [{ - 'id': 0, - 'chargerId': 42, - 'enable': 1, - 'max_current': 1, - 'max_energy': 0, - 'days': {'friday': True, 'monday': True, 'saturday': True, 'sunday': True, 'thursday': True, - 'tuesday': True, 'wednesday': True}, - 'start': '2100', - 'stop': '0500' - }] - } - - Where id is the position to add/replace - """ - def setChargerSchedules(self, chargerId, newSchedules): try: # Enforce chargerId