Async Python client for NRGkick Gen2 EV charger local REST API
Project description
nrgkick-api
Async Python client for NRGkick Gen2 EV charger local REST API.
Overview
This library provides an async Python interface for communicating with NRGkick Gen2 EV chargers via their local REST JSON API. It is designed to be used with Home Assistant but can be used standalone in any async Python application.
Features
- Async/await support - Built on aiohttp for efficient async I/O
- Automatic retry logic - Handles transient network errors with exponential backoff
- Authentication support - Optional HTTP Basic Auth
- Type hints - Full type annotation for better IDE support
- Minimal dependencies - Only requires aiohttp
Installation
pip install nrgkick-api
Quick Start
import asyncio
import aiohttp
from nrgkick_api import NRGkickAPI
async def main():
async with aiohttp.ClientSession() as session:
api = NRGkickAPI(
host="192.168.1.100",
username="admin", # Optional
password="secret", # Optional
session=session,
)
# Get device information
info = await api.get_info()
print(f"Device: {info['general']['device_name']}")
print(f"Serial: {info['general']['serial_number']}")
# Get current values
values = await api.get_values()
print(f"Power: {values['powerflow']['total_active_power']}W")
# Control charging
await api.set_current(16.0) # Set to 16A
await api.set_charge_pause(True) # Pause charging
asyncio.run(main())
API Reference
NRGkickAPI
The main client class for communicating with NRGkick devices.
Constructor
NRGkickAPI(
host: str,
username: str | None = None,
password: str | None = None,
session: aiohttp.ClientSession | None = None,
)
host: IP address or hostname of the NRGkick deviceusername: Optional username for HTTP Basic Authpassword: Optional password for HTTP Basic Authsession: aiohttp ClientSession (required for making requests)
Methods
| Method | Description |
|---|---|
get_info(sections=None) |
Get device information |
get_control() |
Get current control parameters |
get_values(sections=None) |
Get real-time telemetry data |
set_current(current) |
Set charging current (6.0-32.0A) |
set_charge_pause(pause) |
Pause/resume charging |
set_energy_limit(limit) |
Set energy limit in Wh (0=unlimited) |
set_phase_count(phases) |
Set phase count (1-3) |
test_connection() |
Test device connectivity |
Exceptions
| Exception | Description |
|---|---|
NRGkickError |
Base exception for all NRGkick errors |
NRGkickConnectionError |
Network/communication errors |
NRGkickAuthenticationError |
Authentication failures (401/403) |
API Endpoints
The library communicates with three main endpoints:
/info- Device information (serial, model, versions, etc.)/control- Control parameters (current, pause, limits)/values- Real-time telemetry (power, energy, temperatures)
Requirements
- Python 3.11+
- aiohttp 3.8.0+
- NRGkick Gen2 with JSON API enabled
Enabling the JSON API
The local REST API must be enabled in the NRGkick mobile app:
- Open the NRGkick app
- Connect to your device
- Navigate to Settings → JSON API
- Enable the API
- Optionally configure authentication
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Related Projects
- nrgkick-homeassistant - Home Assistant integration using this library
Project details
Release history Release notifications | RSS feed
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 nrgkick_api-1.0.0.tar.gz.
File metadata
- Download URL: nrgkick_api-1.0.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f166d8880efd97edba47ed0fe983f83beccb30dab0184b121b245c320e3f7db4
|
|
| MD5 |
f522aecc7be49c0f4f46f6ce1709ee1c
|
|
| BLAKE2b-256 |
3d51dd6e8907b28a9c27fc91a5dc88ed92d1f1bf56c113b2d557392eef2ff640
|
File details
Details for the file nrgkick_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nrgkick_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
360bc8e077f298be68ebe586d87f686f0ece47ab1f766832d86f32fe2fd721b6
|
|
| MD5 |
c2b7e2ac19005ac0263cbbbce2c63231
|
|
| BLAKE2b-256 |
63480c0d4adb6f5cc0ff1482366c375f9b8361e15d3631e96371a6a97dd4bd78
|