# wallbox
Python Module interface for Wallbox EV chargers api
## Requirements
Python 3.7 or older Python modules "requests>=2.22.0", "simplejson>=3.16.0"
Python module "aenum>=3.1.8"
## Installation
```python
pip install wallbox
```
## Implemented methods
### authenticate()
- authenticates to the wallbox api.
### getChargersList()
- returns a list of chargers available to the account
### getChargerStatus(chargerID)
- returns a dictionary containing the charger status data
### unlockCharger(chargerId)
- unlocks charger
### lockCharger(chargerId)
- locks charger
### setMaxChargingCurrent(chargerId, chargingCurrentValue)
- sets charger Maximum Charging Current (Amps)
### pauseChargingSession(chargerId)
- pauses a charging session
### resumeChargingSession(chargerId)
- resumes a charging session
### resumeSchedule(chargerId)
- revert charger back to default schedule after manually starting a charging session, it reverts the charger back into "Eco Smart and Scheduled" charing mode, if used.
### getSessionList(chargerId, startDate, endDate)
- provides the list of charging sessions between startDate and endDate
- startDate and endDate are provided in Python datetime format (i.e. 2021-05-04 08:41:12.765644)
### setEnergyCost(chargerId, energyCost)
- sets the energy cost for the charger per kWh
### restartCharger(chargerId)
- restarts (reboots) charger
- 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.
Response is a JSON structure like the following:
```json
{
'schedules': [{
'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'
}]
}
```
### setChargerSchedules(chargerId, newSchedules)
- Create or replace an existing schedule.
`newSchedules` is a dictionary like the following:
```json
{
'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'
}]
}
```
As schedules returned by `getChargerSchedules` are positional, the `id` field in the payload represents the position of the schedule to add/replace.
## Simple example
```python
from wallbox import Wallbox, Statuses
import time
import datetime
w = Wallbox("user@email", "password")
# Authenticate with the credentials above
w.authenticate()
# Print a list of chargers in the account
print(w.getChargersList())
# Get charger data for all chargers in the list, then lock and unlock chargers
for chargerId in w.getChargersList():
chargerStatus = w.getChargerStatus(chargerId)
print(f"Charger Status: {chargerStatus}")
print(f"Lock Charger {chargerId}")
endDate = datetime.datetime.now()
startDate = endDate - datetime.timedelta(days = 30)
sessionList = w.getSessionList(chargerId, startDate, endDate)
print(f"Session List: {sessionList}")
w.lockCharger(chargerId)
time.sleep(10)
chargerStatus = w.getChargerStatus(chargerId)
print(f"Charger {chargerId} lock status {chargerStatus['config_data']['locked']}")
print(f"Unlock Charger {chargerId}")
w.unlockCharger(chargerId)
time.sleep(10)
chargerStatus = w.getChargerStatus(chargerId)
print(f"Charger {chargerId} lock status {chargerStatus['config_data']['locked']}")
# Set charger Energy Cost to 0.1€/kWh
energyCost = w.setEnergyCost(chargerId, 0.1)
print(f"Charger {chargerId} energy cost {energyCost['energy_price']} {energyCost['currency']['symbol']}")
# Print the status the charger is currently in using the status id
print(f"Charger Mode: {Statuses(chargerStatus['status_id']).name}")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/cliviu74/wallbox",
"name": "wallbox",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Liviu Chiribuca",
"author_email": "cliviu74@yahoo.com",
"download_url": "https://files.pythonhosted.org/packages/5b/b3/168bcb6126e3027a801cccfc47102fb020e006503c632a70925bbf0846aa/wallbox-0.7.0.tar.gz",
"platform": null,
"description": "# wallbox\n\nPython Module interface for Wallbox EV chargers api\n\n## Requirements\n\nPython 3.7 or older Python modules \"requests>=2.22.0\", \"simplejson>=3.16.0\"\n\nPython module \"aenum>=3.1.8\"\n\n## Installation\n\n```python\npip install wallbox\n```\n\n## Implemented methods\n\n### authenticate()\n\n- authenticates to the wallbox api.\n\n### getChargersList()\n\n- returns a list of chargers available to the account\n\n### getChargerStatus(chargerID)\n\n- returns a dictionary containing the charger status data\n\n### unlockCharger(chargerId)\n\n- unlocks charger\n\n### lockCharger(chargerId)\n\n- locks charger\n\n### setMaxChargingCurrent(chargerId, chargingCurrentValue)\n\n- sets charger Maximum Charging Current (Amps)\n\n### pauseChargingSession(chargerId)\n\n- pauses a charging session\n\n### resumeChargingSession(chargerId)\n\n- resumes a charging session\n\n### resumeSchedule(chargerId)\n\n- revert charger back to default schedule after manually starting a charging session, it reverts the charger back into \"Eco Smart and Scheduled\" charing mode, if used.\n\n### getSessionList(chargerId, startDate, endDate)\n\n- provides the list of charging sessions between startDate and endDate\n- startDate and endDate are provided in Python datetime format (i.e. 2021-05-04 08:41:12.765644)\n\n### setEnergyCost(chargerId, energyCost)\n\n- sets the energy cost for the charger per kWh\n\n### restartCharger(chargerId)\n\n- restarts (reboots) charger\n- a full charger reboot can take a few minutes. Charger status will be slow to update (ie: READY (10s) -> DISCONNECTED (90s) -> READY)\nCAUTION: use this method with care!! Check if the charger is not in the middle of a firmware upgrade as this can brick your charger. \n\n\n### setIcpMaxCurrent(chargerId, newIcpMaxCurrentValue)\n\n- sets charger Maximum ICP Current available (Amps).\n\nPlease note that the wallbox may refuse this action if not setup properly of if not supported by your model\n\n\n### getChargerSchedules(chargerId)\n\n- gets the currently configured schedules for that charger. \n\nResponse is a JSON structure like the following:\n\n```json\n{\n 'schedules': [{\n 'chargerId': 42,\n 'enable': 1,\n 'max_current': 1,\n 'max_energy': 0,\n 'days': {'friday': true, 'monday': true, 'saturday': true, 'sunday': true, 'thursday': true,\n 'tuesday': true, 'wednesday': true},\n 'start': '2100',\n 'stop': '0500'\n }]\n}\n```\n\n### setChargerSchedules(chargerId, newSchedules)\n\n- Create or replace an existing schedule. \n\n`newSchedules` is a dictionary like the following:\n\n```json\n{\n 'schedules': [{\n 'id': 0,\n 'chargerId': 42,\n 'enable': 1,\n 'max_current': 1,\n 'max_energy': 0,\n 'days': {'friday': true, 'monday': true, 'saturday': true, 'sunday': true, 'thursday': true,\n 'tuesday': true, 'wednesday': true},\n 'start': '2100',\n 'stop': '0500'\n }]\n}\n```\n\nAs schedules returned by `getChargerSchedules` are positional, the `id` field in the payload represents the position of the schedule to add/replace.\n\n## Simple example\n\n```python\nfrom wallbox import Wallbox, Statuses\nimport time\nimport datetime\n\nw = Wallbox(\"user@email\", \"password\")\n\n# Authenticate with the credentials above\nw.authenticate()\n\n# Print a list of chargers in the account\nprint(w.getChargersList())\n\n# Get charger data for all chargers in the list, then lock and unlock chargers\nfor chargerId in w.getChargersList():\n chargerStatus = w.getChargerStatus(chargerId)\n print(f\"Charger Status: {chargerStatus}\")\n print(f\"Lock Charger {chargerId}\")\n endDate = datetime.datetime.now()\n startDate = endDate - datetime.timedelta(days = 30)\n sessionList = w.getSessionList(chargerId, startDate, endDate)\n print(f\"Session List: {sessionList}\")\n w.lockCharger(chargerId)\n time.sleep(10)\n chargerStatus = w.getChargerStatus(chargerId)\n print(f\"Charger {chargerId} lock status {chargerStatus['config_data']['locked']}\")\n print(f\"Unlock Charger {chargerId}\")\n w.unlockCharger(chargerId)\n time.sleep(10)\n chargerStatus = w.getChargerStatus(chargerId)\n print(f\"Charger {chargerId} lock status {chargerStatus['config_data']['locked']}\")\n # Set charger Energy Cost to 0.1\u20ac/kWh\n energyCost = w.setEnergyCost(chargerId, 0.1)\n print(f\"Charger {chargerId} energy cost {energyCost['energy_price']} {energyCost['currency']['symbol']}\")\n\n # Print the status the charger is currently in using the status id\n print(f\"Charger Mode: {Statuses(chargerStatus['status_id']).name}\")\n```\n",
"bugtrack_url": null,
"license": "Apache 2",
"summary": "Module for interacting with Wallbox EV charger api",
"version": "0.7.0",
"project_urls": {
"Homepage": "https://github.com/cliviu74/wallbox"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fd7329473f645b0a11f602fa413448c6a1a048ebc3e38587783988b3d2a8d103",
"md5": "ac97079b768dab59c193e839cb57fd21",
"sha256": "8946c77830cc7bc943313fb339d75876977fe4a68ed35fafb16780e27ed213f2"
},
"downloads": -1,
"filename": "wallbox-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ac97079b768dab59c193e839cb57fd21",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 9273,
"upload_time": "2024-05-22T17:17:43",
"upload_time_iso_8601": "2024-05-22T17:17:43.869564Z",
"url": "https://files.pythonhosted.org/packages/fd/73/29473f645b0a11f602fa413448c6a1a048ebc3e38587783988b3d2a8d103/wallbox-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5bb3168bcb6126e3027a801cccfc47102fb020e006503c632a70925bbf0846aa",
"md5": "a67b70a02a03411f9de75242a1e18650",
"sha256": "f2d699a42d4de59b15bab875d16a2c66f83b5839a8addf8f0df847a5195fa811"
},
"downloads": -1,
"filename": "wallbox-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "a67b70a02a03411f9de75242a1e18650",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 8617,
"upload_time": "2024-05-22T17:17:45",
"upload_time_iso_8601": "2024-05-22T17:17:45.739150Z",
"url": "https://files.pythonhosted.org/packages/5b/b3/168bcb6126e3027a801cccfc47102fb020e006503c632a70925bbf0846aa/wallbox-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-22 17:17:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cliviu74",
"github_project": "wallbox",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aenum",
"specs": [
[
"==",
"3.1.15"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2023.7.22"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.7"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.0"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.0.7"
]
]
}
],
"lcname": "wallbox"
}