Skip to content

Commit

Permalink
Merge branch 'master' into docs-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Floris272 committed Feb 29, 2024
2 parents 5bb347a + c23e525 commit d939064
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[MASTER]
ignore-patterns=test_*.py
ignore-patterns=test_*.py
disable=useless-import-alias
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The library is an asyncio-driven library that interfaces with the Websocket API

- Python 3.11 or newer
- websockets
- asyncio
- pytz

### Installation

Expand All @@ -32,25 +32,25 @@ import asyncio


async def main():
api_token = 'api_token'
api_token = 'VDLAU17BLVKNNK6X2MBUD007MWNHN9R2'
client = Client()

# data receiver
def on_data(data):
async def on_data(data):
print('received: ', data)

# connect to the websocket
await client.connect(api_token)
# validate and set token.
await client.validate_api_token(api_token)

# example requests
async def requests():
await client.get_charge_points()
await client.wait_for_response()
await asyncio.sleep(10)
await client.disconnect()

# start the loop and send requests
# connect and send requests
await asyncio.gather(
client.start_loop(on_data),
client.connect(on_data),
requests()
)

Expand All @@ -61,37 +61,33 @@ asyncio.run(main())

---

<b>The methods validate_token, get_account and get_charge_cards are stand-alone and to be used <u>before</u> connecting to the websocket with connect().</b>
<b>The methods validate_token and get_email are stand-alone and are to be used <u>before</u> connecting to the websocket with connect().</b>

<br>

#### await validate_token(api_token) -> bool
#### await validate_token(api_token) -> str

- Validates the given token.

#### await get_account() -> bool
#### await get_email() -> str

- Returns the account's email.

#### await get_charge_cards(auth_token) -> list

- Returns the users charge cards.

---

#### await connect(auth_token)
#### await connect(receiver)

- Connects to the websocket.
- Calls get_charge_points and get_charge_cards when connection is established.

#### await start_loop(receiver)

- Starts the loop and routes the incoming messages to the given receiver method
#### is_connected() -> bool
- Returns if the client is connected

#### await wait_for_response()
#### await wait_for_charge_points()
- Waits until chargepoints are received.

- Waits until the next message is received.

#### get_next_reset_delta()
#### get_next_reset_delta() -> TimeDelta

- Returns the timedelta to the next request limit reset (00:00 Europe/Amsterdam).

Expand All @@ -109,6 +105,10 @@ asyncio.run(main())

- Gets the chargepoints

#### await get_charge_cards()

- Returns the users charge cards.

#### await get_status(evse_id)

- Gets the status from a chargepoint.
Expand All @@ -127,17 +127,17 @@ asyncio.run(main())

---

#### await set_public_charging(evse_id, value)
#### await set_linked_charge_cards_only(evse_id, value)

- Sets public charging to True or False.
- Sets set_linked_charge_cards_only.

#### await set_plug_and_charge(evse_id, value)

- Sets plug and charge to True or False.
- Sets set_plug_and_charge.

#### await set_operative(evse_id, value)
#### await block(evse_id, value)

- Sets operative to True or False.
- Blocks or unblocks a charge point.

<br>

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "bluecurrent-api"
version = "1.2.0"
version = "1.2.1"
authors = [
{ name="Floris272", email="[email protected]" },
]
Expand All @@ -18,7 +18,7 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"websockets >= 12.0",
"websockets >= 10.0",
"pytz >= 2023.4"
]

Expand Down
2 changes: 1 addition & 1 deletion src/bluecurrent_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Define module exports."""
from .client import Client
from .client import Client as Client

0 comments on commit d939064

Please sign in to comment.