Skip to main content

NexBlue API

nexblue-api is the official asynchronous Python client for the NexBlue OpenAPI. It is maintained by NexBlue and currently provides the communication layer used by the NexBlue Home Assistant integration.

The package handles authentication, access-token refresh, charger discovery, charger telemetry, charging commands, and dynamic current-limit control. It is also able to discover owned load balancers and query Smart Meter statistics. It is deliberately independent of Home Assistant so it can be reused by other Python applications.

Requirements

  • Python 3.13 or later
  • A NexBlue account with access to the NexBlue OpenAPI

Installing this library does not create, grant, or expand access to a NexBlue account or service.

Installation

pip install nexblue-api

Basic usage

Keep credentials outside source code. The example uses environment variables and a placeholder API base URL supplied by NexBlue.

import asyncio
import os

import aiohttp

from nexblue_api import NexBlueClient


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        client = NexBlueClient(
            session,
            os.environ["NEXBLUE_API_BASE_URL"],
        )

        await client.async_login(
            os.environ["NEXBLUE_USERNAME"],
            os.environ["NEXBLUE_PASSWORD"],
        )

        for charger in await client.async_list_chargers():
            status = await client.async_get_charger_status(charger.serial_number)
            print(charger.serial_number, status.charging_state, status.power_kw)


asyncio.run(main())

Supported operations

  • End-user login and refresh-token based access-token renewal
  • Charger discovery
  • Charger status and telemetry retrieval
  • Start charging and stop charging commands
  • Set the dynamic current limit (A), with its value included in charger status when supported
  • List load balancers owned by the authenticated end user
  • Query historical Smart Meter power levels (up to 24 hours) and grouped energy usage (up to 100 groups)
  • Typed charger, status, and token models
  • Safe exceptions for authentication, connection, rate-limit, offline-device, and rejected-command errors

Status values are normalized to the API's documented units: kW, kWh, A, and V. Charging commands can still be rejected by the API or charger, for example when the charger is offline or another user is controlling it.

Credential handling

Do not commit, log, or share usernames, passwords, access tokens, refresh tokens, or OAuth client credentials.

The client retains tokens only for its active lifetime. Applications that need to restore a session should persist only the refresh token using their platform's protected credential storage, then call async_refresh_access_token. Do not persist an end-user password merely to perform automatic logins.

Successful login and refresh calls return a TokenBundle. Its account_id field is the stable account subject provided by the access token when available. Applications may use this value as a local, non-secret account identifier; they should not derive identity from a username or log the access token itself.

This library does not embed NexBlue OAuth client credentials. Applications using an external OAuth flow may provide an externally managed access token with set_access_token.

Development

python -m pytest -q
python -m build
python -m twine check dist/*

Please report bugs through the repository issue tracker. Do not include credentials, tokens, full API responses, or personally identifiable charger information in issues.

License

Copyright 2026 NexBlue.

Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.

Metadata

Release files for nexblue-api 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexblue-api 0.1.4
File Size Uploaded Provenance Actions
nexblue_api-0.1.4.tar.gz 15.0 kB With provenance Details for nexblue_api-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nexblue-api 0.1.4
File Interpreter ABI Platform Actions
nexblue_api-0.1.4-py3-none-any.whl Python 3 none any Details for nexblue_api-0.1.4-py3-none-any.whl

Total release size: 28.3 kB

Release files / nexblue_api-0.1.4.tar.gz

Download URL nexblue_api-0.1.4.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
39d5b981edd313383be5c080a0d1f52fc887123ee2fc5b20c5abe62bb559b59c
BLAKE2b-256 checksum
How to use checksums
2a576c8b81f58093e95fab0ad40b71dd734e1e11c89b13df75853d9024b4c7e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / nexblue_api-0.1.4-py3-none-any.whl

Download URL nexblue_api-0.1.4-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a709b00ec89f2a7b1a628be88e53537f47f66d766569ce0a55b657186a17870e
BLAKE2b-256 checksum
How to use checksums
320e7823718cb0158fe15e20141863b2dfaf06fc3e2348f69536917524f1990a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for nexblue-api 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nexblue_api-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page