Blue Current Api
Python wrapper for the blue current api
The library is an asyncio-driven library that interfaces with the Websocket API provided by Blue Current. This was made for the Blue Current Home Assistant integration.
Usage
Requirements
- Python 3.11 or newer
- websockets
Installation
pip install bluecurrent-api
Api token
Using this library requires a Blue Current api token. You can generate one in the Blue Current driver portal.
Example
from bluecurrent_api import Client
import asyncio
async def main():
api_token = 'api_token'
client = Client()
# data receiver
async def on_data(data):
print('received: ', data)
# validate and set token.
await client.validate_api_token(api_token)
# example requests
async def on_open():
await client.get_charge_points()
await asyncio.sleep(10)
await client.disconnect()
# connect and send requests
await client.connect(on_data, on_open)
asyncio.run(main())
Implemented methods
The methods validate_token and get_email are stand-alone and are to be used before connecting to the websocket with connect().
await validate_token(api_token) -> str
- Validates the given token.
await get_email() -> str
- Returns the account's email.
await connect(receiver)
- Connects to the websocket.
- Calls get_charge_points and get_charge_cards when connection is established.
is_connected() -> bool
- Returns if the client is connected
await wait_for_charge_points()
- Waits until chargepoints are received.
get_next_reset_delta() -> TimeDelta
- Returns the timedelta to the next request limit reset (00:00 Europe/Amsterdam).
await disconnect()
- Stops the connection.
Data
await get_charge_points()
- Gets the chargepoints
await get_charge_cards()
- Returns the users charge cards.
await get_status(evse_id)
- Gets the status from a chargepoint.
await get_settings(evse_id)
- Gets the setting states from a chargepoint.
await get_grid_status(evse_id)
- Gets the grid status from a chargepoint.
await get_user_override_currents_list()
- Returns a list with current override values set by the user and the related scheduling data.
Settings
await set_linked_charge_cards_only(evse_id, value)
- Sets set_linked_charge_cards_only.
await set_plug_and_charge(evse_id, value)
- Sets set_plug_and_charge.
await block(evse_id, value)
- Blocks or unblocks a charge point.
Actions
await reset(evse_id)
- Resets the chargepoint.
await reboot(evse_id)
- Reboots the chargepoint.
await start_session(evse_id card_uid)
- Starts a charge session.
await stop_session(evse_id)
- Stops a charge session.
await set_delayed_charging(evse_id, value)
- Turns smart charging profile on/off and sets the profile to delayed charging.
await set_delayed_charging_settings(evse_id, days, start_time, end_time)
- Sends the settings for the scheduling of the delayed charging profile.
await set_price_based_charging(evse_id, value)
- Turns smart charging profile on/off and sets the profile to price based charging.
await set_price_based_settings(evse_id, expected_departure_time, expected_kwh, minimum_kwh)
- Sends the settings for the price based charging profile.
await override_price_based_charging_profile(evse_id: str, value)
- Overrides the settings set up by the price based charging profile and starts charging immediately.
await override_delayed_charging_profile(evse_id, value)
- Overrides the timeout set by the delayed charging profile and starts charging immediately.
await set_user_override_current(payload)
- Schedules an override of the electricity current that chargepoints are allowed to use when charging.
await clear_user_override_current(schedule_id)
- Clears a previously set user override using the given schedule ID.
edit_user_override_current(schedule_id, payload)
- Lets the user edit a scheduled override of the electricity current that chargepoints are allowed to use when charging.
Metadata
Release files for bluecurrent-api 1.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bluecurrent_api-1.3.3.tar.gz | 16.7 kB | Without provenance | Details for bluecurrent_api-1.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bluecurrent_api-1.3.3-py3-none-any.whl | Python 3 | none | any | Details for bluecurrent_api-1.3.3-py3-none-any.whl |
Total release size: 29.0 kB
Release files / bluecurrent_api-1.3.3.tar.gz
| Download URL | bluecurrent_api-1.3.3.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d96396f25b0d12513af45d1191c3310d54b68b939b23b712ae6cf7d536f0278a
|
|
BLAKE2b-256 checksum How to use checksums |
39247236e3c13a9ce29a4be6344e9097bf9b84a50c60562665308011576eb2f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / bluecurrent_api-1.3.3-py3-none-any.whl
| Download URL | bluecurrent_api-1.3.3-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93c4b136197e372b89d2ba9b80c64f5cc0b3308de86cc9a2e153384c16cd5645
|
|
BLAKE2b-256 checksum How to use checksums |
e0d812b21d327469677bc28522eb83c8239497a6cddede283f17338b38341329
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for bluecurrent-api 1.3.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.