Skip to main content

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.

PyPI version Python Support License: MIT

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 aiohttp for 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

  1. Copy the custom_components/drivee folder to your Home Assistant's custom_components directory.
  2. Restart Home Assistant.

Configuration

  1. Go to Home Assistant's Settings > Devices & Services
  2. Click "Add Integration"
  3. Search for "Drivee"
  4. Enter your Drivee API base URL
  5. (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:

  1. Clone this repository

  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Make your changes

  4. Test the integration locally

  5. Copy the modified files to your Home Assistant's custom_components directory

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

driveeclient-0.1.1.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

driveeclient-0.1.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file driveeclient-0.1.1.tar.gz.

File metadata

  • Download URL: driveeclient-0.1.1.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for driveeclient-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00b40596053a67f0d4e265672a67170ca2c52e3c6f76dc92498598e465feb771
MD5 5c88488e6532b0fc86822c2e5a111ec2
BLAKE2b-256 4cda65dc3c0c464d65d3cd38f945c59f8aa0ae8b56945bf133062f81f2e3e80d

See more details on using hashes here.

Provenance

The following attestation bundles were made for driveeclient-0.1.1.tar.gz:

Publisher: python-publish.yml on thomas3650/driveeClient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file driveeclient-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: driveeclient-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for driveeclient-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 803d05e110c944abba669c96cb385222c8f2232d0003c3c47c2b4b25439934e7
MD5 67a1068fd9a069f16d4afb54c90a40c8
BLAKE2b-256 92037dd4a6bea1dfce9cb2ffb654d3d49dedb37d41caebcefe0ecc05516356df

See more details on using hashes here.

Provenance

The following attestation bundles were made for driveeclient-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on thomas3650/driveeClient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page