Python client library for automation and control of an EV Wallbox charger via local API or cloud endpoints
Project description
Drivee Client
A Python client library for automation and control of EV Wallbox chargers via the Drivee cloud API.
Installation
pip install drivee-client
Quick Start
import asyncio
from drivee_client import DriveeClient
async def main():
async with DriveeClient("username", "password") as client:
await client.init()
# Get charge point info
charge_point = await client.get_charge_point()
print(f"Charge point: {charge_point.name}")
print(f"Status: {charge_point.evse.status}")
# Start charging
response = await client.start_charging()
print(f"Started session: {response.session.id}")
# Get charging history
history = await client.get_charging_history()
for session in history.sessions:
print(f"Session {session.id}: {session.energy/1000:.2f}kWh")
if __name__ == "__main__":
asyncio.run(main())
Features
- Async/await support - Built with
aiohttpfor non-blocking I/O - Type-safe - Full type hints with Pydantic models
- Error handling - Comprehensive error handling with custom exceptions
- Rate limiting - Built-in retry logic with exponential backoff
- Clean architecture - Separation of DTOs and business models
- Domain validation - Business rule validation in model layer
Architecture
The client library follows a clear separation of concerns with three main layers:
Data Transfer Objects (DTOs)
Located in dtos/, these are pure data classes that:
- Match the exact structure of API responses
- Use Pydantic for validation and serialization
- Have no business logic
- Follow naming convention: All DTO classes end with 'DTO' suffix
- Are only used within the model layer
Business Models
Located in models/, these classes:
- Encapsulate DTOs and provide business logic
- Expose only business-relevant properties and methods
- Use Protocol-based typing for DTO interfaces
- Handle all business rules and validations
- Are the only classes exposed to the Home Assistant integration
API Client
The drivee_client.py handles:
- REST API communication
- Authentication
- Request/response mapping to DTOs
- Error handling and retries
Installation
- Copy the
custom_components/driveefolder to your Home Assistant'scustom_componentsdirectory. - Restart Home Assistant.
Configuration
- Go to Home Assistant's Settings > Devices & Services
- Click "Add Integration"
- Search for "Drivee"
- Enter your Drivee API base URL
- (Optional) Enter your API key if required
Usage
After configuration, you can control your Drivee device through Home Assistant's interface. The integration will create a switch entity that you can use to control your device.
Development
To develop or modify this integration:
-
Clone this repository
-
Install dependencies:
pip install -r requirements.txt
-
Make your changes
-
Test the integration locally
-
Copy the modified files to your Home Assistant's
custom_componentsdirectory
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file driveeclient-0.1.6.tar.gz.
File metadata
- Download URL: driveeclient-0.1.6.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a1defc8a54fb80f21d86f7a927077164c20b490a87e78c7f08339e4628e7c22
|
|
| MD5 |
56d9b176b5adefdad6c49ee6bb480647
|
|
| BLAKE2b-256 |
ba49e83afaa449b302b2bd03b9d6777b4ac3fad299ccb93ce80c5fa59faac3f5
|
Provenance
The following attestation bundles were made for driveeclient-0.1.6.tar.gz:
Publisher:
python-publish.yml on thomas3650/driveeClient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
driveeclient-0.1.6.tar.gz -
Subject digest:
7a1defc8a54fb80f21d86f7a927077164c20b490a87e78c7f08339e4628e7c22 - Sigstore transparency entry: 933558295
- Sigstore integration time:
-
Permalink:
thomas3650/driveeClient@617fb711bfe4b7195840373e2e18f17986474409 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/thomas3650
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@617fb711bfe4b7195840373e2e18f17986474409 -
Trigger Event:
push
-
Statement type:
File details
Details for the file driveeclient-0.1.6-py3-none-any.whl.
File metadata
- Download URL: driveeclient-0.1.6-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6970956663fd685a9b4ce7c33889fe7a77d703be0594f2fd5a44cbf4e6ea285
|
|
| MD5 |
6bbc12b74dcaf654933eb1997abb49a0
|
|
| BLAKE2b-256 |
bda19b1dcc72fb9a59321a840eecef981a8d164d3810b957a5c886d9b27799fc
|
Provenance
The following attestation bundles were made for driveeclient-0.1.6-py3-none-any.whl:
Publisher:
python-publish.yml on thomas3650/driveeClient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
driveeclient-0.1.6-py3-none-any.whl -
Subject digest:
f6970956663fd685a9b4ce7c33889fe7a77d703be0594f2fd5a44cbf4e6ea285 - Sigstore transparency entry: 933558329
- Sigstore integration time:
-
Permalink:
thomas3650/driveeClient@617fb711bfe4b7195840373e2e18f17986474409 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/thomas3650
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@617fb711bfe4b7195840373e2e18f17986474409 -
Trigger Event:
push
-
Statement type: