Skip to main content

Async Python client for EV Tracker API

Project description

aioevtracker

Async Python client for EV Tracker API.

Installation

pip install aioevtracker

Usage

import asyncio
from aioevtracker import EVTrackerClient

async def main():
    async with EVTrackerClient(api_key="your-api-key") as client:
        # Get all cars
        cars = await client.get_cars()
        for car in cars:
            print(f"{car.name} (ID: {car.id})")

        # Get charging statistics
        state = await client.get_state()
        print(f"Monthly energy: {state.monthly_energy} kWh")
        print(f"Monthly cost: {state.monthly_cost} CZK")

        # Log a charging session
        session = await client.log_session_simple(
            energy_kwh=45.5,
            energy_source="GRID",
            rate_type="LOW",
        )
        print(f"Logged session ID: {session.id}")

asyncio.run(main())

With existing aiohttp session

import aiohttp
from aioevtracker import EVTrackerClient

async with aiohttp.ClientSession() as session:
    client = EVTrackerClient(
        api_key="your-api-key",
        session=session,
    )
    cars = await client.get_cars()

API Reference

EVTrackerClient

  • get_cars() - Get list of user's cars
  • get_default_car() - Get default car
  • get_state() - Get Home Assistant state with statistics
  • log_session(...) - Log a charging session with full control
  • log_session_simple(...) - Log a charging session with smart defaults
  • validate_api_key() - Validate the API key

Models

  • Car - Electric vehicle
  • ChargingSession - Charging session
  • HomeAssistantState - Statistics state

Exceptions

  • EVTrackerApiError - Base exception
  • EVTrackerAuthenticationError - Invalid API key (401/403)
  • EVTrackerConnectionError - Connection failed
  • EVTrackerRateLimitError - Rate limit exceeded (429)

License

MIT

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

aioevtracker-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

aioevtracker-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file aioevtracker-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for aioevtracker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb258aeaf154b2af86d0dc9782bd9236b59ca04f93542cf202e497a2119dfd2b
MD5 2eb21d935791ffeaa8d4ffec52e63214
BLAKE2b-256 16aa390df187ce7ad884aca44b3ad68d758a8fff8c6726461f7a46070d1dfeba

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioevtracker-0.1.0.tar.gz:

Publisher: publish.yml on petrmac/aio-evtracker

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

File details

Details for the file aioevtracker-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for aioevtracker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2173d6bb820c72d4bf85a253c34fddbc3dbffb44406114b7e16b5789d1b005e2
MD5 2c70b5da1236f97dba487af5d98b2341
BLAKE2b-256 ce1df4a844759c3c89be517e4f6436a0a1cf6c187e4306f74fb5476200b30ad9

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioevtracker-0.1.0-py3-none-any.whl:

Publisher: publish.yml on petrmac/aio-evtracker

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