pybluecurrent 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/.pre-commit-config.yaml +2 -2
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/PKG-INFO +15 -5
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/README.md +10 -1
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/pyproject.toml +6 -1
- pybluecurrent-0.0.4/src/pybluecurrent/_version.py +34 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent/client.py +24 -7
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/PKG-INFO +15 -5
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/requires.txt +2 -2
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/tests/conftest.py +4 -19
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/tests/test_client.py +33 -18
- pybluecurrent-0.0.2/src/pybluecurrent/_version.py +0 -16
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/.github/workflows/publish.yaml +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/.github/workflows/test.yaml +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/.gitignore +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/LICENSE +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/setup.cfg +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent/__init__.py +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent/exceptions.py +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent/py.typed +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent/utilities.py +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/SOURCES.txt +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/dependency_links.txt +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/top_level.txt +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.4}/tests/test_utilities.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
fail_fast: true
|
|
2
2
|
repos:
|
|
3
3
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
-
rev:
|
|
4
|
+
rev: v6.0.0
|
|
5
5
|
hooks:
|
|
6
6
|
- id: trailing-whitespace
|
|
7
7
|
exclude: '\.(md|markdown)$'
|
|
@@ -27,7 +27,7 @@ repos:
|
|
|
27
27
|
- id: isort
|
|
28
28
|
exclude: __init__.py
|
|
29
29
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
30
|
-
rev:
|
|
30
|
+
rev: v1.18.2
|
|
31
31
|
hooks:
|
|
32
32
|
- id: mypy
|
|
33
33
|
additional_dependencies:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pybluecurrent
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Python client for BlueCurrent charge points.
|
|
5
5
|
Author-email: Rogier van der Geer <rogier@vander-geer.nl>
|
|
6
6
|
License: MIT
|
|
@@ -21,8 +21,9 @@ Requires-Dist: websockets>=11.0.3
|
|
|
21
21
|
Provides-Extra: dev
|
|
22
22
|
Requires-Dist: black==23.3.0; extra == "dev"
|
|
23
23
|
Requires-Dist: pre-commit>=3.3.3; extra == "dev"
|
|
24
|
-
Requires-Dist: pytest
|
|
25
|
-
Requires-Dist: pytest-asyncio
|
|
24
|
+
Requires-Dist: pytest==8.4.2; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-asyncio==1.2.0; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
26
27
|
|
|
27
28
|
# pybluecurrent
|
|
28
29
|
|
|
@@ -59,6 +60,7 @@ As a result, the `BlueCurrentClient` also exposes synchronous as well as asynchr
|
|
|
59
60
|
- [`get_charge_point_settings`](#getchargepointsettings---get-the-settings-of-a-charge-point)
|
|
60
61
|
- [`get_grid_status`](#getgridstatus---get-the-grid-status-associated-to-a-charge-point)
|
|
61
62
|
- [`get_sustainability_status`](#getsustainabilitystatus---get-statistics-on-the-sustainability-of-all-your-charge-points)
|
|
63
|
+
- [`set_plug_and_charge_charge_card`](#setplugandchargechargecard---set-the-charge-card-for-plug-and-charge)
|
|
62
64
|
- [`set_status`](#setstatus---enable-or-disable-a-charge-point)
|
|
63
65
|
- [Synchronous](#synchronous)
|
|
64
66
|
- [`login`](#login---log-in)
|
|
@@ -167,7 +169,7 @@ All the information returned by this endpoint is already included
|
|
|
167
169
|
in the response of [`get_charge_points`](#getchargepoints---get-your-charge-points).
|
|
168
170
|
|
|
169
171
|
```python
|
|
170
|
-
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict | str]
|
|
172
|
+
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict[str, Any] | str]
|
|
171
173
|
```
|
|
172
174
|
|
|
173
175
|
##### Arguments
|
|
@@ -228,6 +230,14 @@ async def get_sustainability_status(self) -> dict[str, float | int]
|
|
|
228
230
|
##### Returns
|
|
229
231
|
A dictionary with two keys: `{"trees": 1, "co2": 12.345}`
|
|
230
232
|
|
|
233
|
+
#### `set_plug_and_charge_charge_card` - Set the charge card for plug-and-charge
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
async def set_plug_and_charge_charge_card(self, evse_id: str, uid: str | None = None) -> None
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Sets the plug-and-charge card for the charge point. The uid must be a `uid` of one of your charge cards (see [`get_charge_cards`](#getchargecards---get-your-charge-cards)) or `None` to use no charge card.
|
|
240
|
+
|
|
231
241
|
#### `set_status` - Enable or disable a charge point.
|
|
232
242
|
|
|
233
243
|
```python
|
|
@@ -33,6 +33,7 @@ As a result, the `BlueCurrentClient` also exposes synchronous as well as asynchr
|
|
|
33
33
|
- [`get_charge_point_settings`](#getchargepointsettings---get-the-settings-of-a-charge-point)
|
|
34
34
|
- [`get_grid_status`](#getgridstatus---get-the-grid-status-associated-to-a-charge-point)
|
|
35
35
|
- [`get_sustainability_status`](#getsustainabilitystatus---get-statistics-on-the-sustainability-of-all-your-charge-points)
|
|
36
|
+
- [`set_plug_and_charge_charge_card`](#setplugandchargechargecard---set-the-charge-card-for-plug-and-charge)
|
|
36
37
|
- [`set_status`](#setstatus---enable-or-disable-a-charge-point)
|
|
37
38
|
- [Synchronous](#synchronous)
|
|
38
39
|
- [`login`](#login---log-in)
|
|
@@ -141,7 +142,7 @@ All the information returned by this endpoint is already included
|
|
|
141
142
|
in the response of [`get_charge_points`](#getchargepoints---get-your-charge-points).
|
|
142
143
|
|
|
143
144
|
```python
|
|
144
|
-
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict | str]
|
|
145
|
+
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict[str, Any] | str]
|
|
145
146
|
```
|
|
146
147
|
|
|
147
148
|
##### Arguments
|
|
@@ -202,6 +203,14 @@ async def get_sustainability_status(self) -> dict[str, float | int]
|
|
|
202
203
|
##### Returns
|
|
203
204
|
A dictionary with two keys: `{"trees": 1, "co2": 12.345}`
|
|
204
205
|
|
|
206
|
+
#### `set_plug_and_charge_charge_card` - Set the charge card for plug-and-charge
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
async def set_plug_and_charge_charge_card(self, evse_id: str, uid: str | None = None) -> None
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Sets the plug-and-charge card for the charge point. The uid must be a `uid` of one of your charge cards (see [`get_charge_cards`](#getchargecards---get-your-charge-cards)) or `None` to use no charge card.
|
|
213
|
+
|
|
205
214
|
#### `set_status` - Enable or disable a charge point.
|
|
206
215
|
|
|
207
216
|
```python
|
|
@@ -32,7 +32,7 @@ dependencies = [
|
|
|
32
32
|
dynamic = ["version"]
|
|
33
33
|
|
|
34
34
|
[project.optional-dependencies]
|
|
35
|
-
dev = ["black==23.3.0", "pre-commit>=3.3.3", "pytest
|
|
35
|
+
dev = ["black==23.3.0", "pre-commit>=3.3.3", "pytest==8.4.2", "pytest-asyncio==1.2.0"]
|
|
36
36
|
|
|
37
37
|
[project.urls]
|
|
38
38
|
Repository = "https://github.com/rogiervandergeer/pybluecurrent"
|
|
@@ -53,3 +53,8 @@ profile = "black"
|
|
|
53
53
|
[tool.ruff]
|
|
54
54
|
line-length = 120
|
|
55
55
|
target-version = "py310"
|
|
56
|
+
|
|
57
|
+
[tool.pytest.ini_options]
|
|
58
|
+
asyncio_mode = "auto"
|
|
59
|
+
asyncio_default_fixture_loop_scope = "session"
|
|
60
|
+
asyncio_default_test_loop_scope = "session"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.0.4'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 0, 4)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'gdbea48bcd'
|
|
@@ -102,7 +102,7 @@ class BlueCurrentClient:
|
|
|
102
102
|
Get a list of your charge points.
|
|
103
103
|
|
|
104
104
|
Returns:
|
|
105
|
-
A list of dictionaries, each representing a charge
|
|
105
|
+
A list of dictionaries, each representing a charge point:
|
|
106
106
|
{
|
|
107
107
|
"evse_id": "BCU123456",
|
|
108
108
|
"name": "",
|
|
@@ -133,7 +133,7 @@ class BlueCurrentClient:
|
|
|
133
133
|
await self._send(dict(command="GET_CHARGE_POINTS"), token=True)
|
|
134
134
|
return (await self._receive("CHARGE_POINTS"))["data"]
|
|
135
135
|
|
|
136
|
-
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict | str]:
|
|
136
|
+
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict[str, Any] | str]:
|
|
137
137
|
"""
|
|
138
138
|
Get the settings of a charge point.
|
|
139
139
|
|
|
@@ -193,11 +193,6 @@ class BlueCurrentClient:
|
|
|
193
193
|
await self._send(dict(command="GET_SESSIONS"), token=True)
|
|
194
194
|
return await self._receive("SESSIONS")
|
|
195
195
|
|
|
196
|
-
async def get_status(self, evse_id: str):
|
|
197
|
-
"""Returns a useless object with evse_id and your full name"""
|
|
198
|
-
await self._send(dict(command="GET_STATUS", evse_id=evse_id), token=True)
|
|
199
|
-
return await self._receive("STATUS")
|
|
200
|
-
|
|
201
196
|
async def get_sustainability_status(self) -> dict[str, float | int]:
|
|
202
197
|
"""
|
|
203
198
|
Get statistics on the sustainability of all your charge points.
|
|
@@ -211,6 +206,28 @@ class BlueCurrentClient:
|
|
|
211
206
|
result.pop("object")
|
|
212
207
|
return result
|
|
213
208
|
|
|
209
|
+
async def set_plug_and_charge_charge_card(self, evse_id: str, uid: str | None = None) -> None:
|
|
210
|
+
"""
|
|
211
|
+
Set a plug-and-charge charge card for the charge point.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
evse_id: A charge point ID.
|
|
215
|
+
uid: A charge card UID or None. Defaults to None.
|
|
216
|
+
Setting the plug-and-charge card to None will result in plug-and-charge
|
|
217
|
+
transactions being started without a charge card. Note that the
|
|
218
|
+
charge point status will show "BCU_HOME_USE" as the charge card.
|
|
219
|
+
Setting the plug-and-charge card to "BCU_HOME_USE" has the same effect
|
|
220
|
+
as setting it to None.
|
|
221
|
+
"""
|
|
222
|
+
token_uid = "BCU-APP" if uid is None or uid == "BCU_HOME_USE" else uid
|
|
223
|
+
await self._send(
|
|
224
|
+
dict(command="SET_PLUG_AND_CHARGE_CHARGE_CARD", evse_id=evse_id, token_uid=token_uid),
|
|
225
|
+
token=True,
|
|
226
|
+
)
|
|
227
|
+
result = await self._receive("STATUS_SET_PLUG_AND_CHARGE_CHARGE_CARD")
|
|
228
|
+
if not result.get("success"):
|
|
229
|
+
raise BlueCurrentException(result)
|
|
230
|
+
|
|
214
231
|
async def set_status(self, evse_id: str, enabled: bool) -> None:
|
|
215
232
|
"""
|
|
216
233
|
Enable or disable a charge point.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pybluecurrent
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Python client for BlueCurrent charge points.
|
|
5
5
|
Author-email: Rogier van der Geer <rogier@vander-geer.nl>
|
|
6
6
|
License: MIT
|
|
@@ -21,8 +21,9 @@ Requires-Dist: websockets>=11.0.3
|
|
|
21
21
|
Provides-Extra: dev
|
|
22
22
|
Requires-Dist: black==23.3.0; extra == "dev"
|
|
23
23
|
Requires-Dist: pre-commit>=3.3.3; extra == "dev"
|
|
24
|
-
Requires-Dist: pytest
|
|
25
|
-
Requires-Dist: pytest-asyncio
|
|
24
|
+
Requires-Dist: pytest==8.4.2; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-asyncio==1.2.0; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
26
27
|
|
|
27
28
|
# pybluecurrent
|
|
28
29
|
|
|
@@ -59,6 +60,7 @@ As a result, the `BlueCurrentClient` also exposes synchronous as well as asynchr
|
|
|
59
60
|
- [`get_charge_point_settings`](#getchargepointsettings---get-the-settings-of-a-charge-point)
|
|
60
61
|
- [`get_grid_status`](#getgridstatus---get-the-grid-status-associated-to-a-charge-point)
|
|
61
62
|
- [`get_sustainability_status`](#getsustainabilitystatus---get-statistics-on-the-sustainability-of-all-your-charge-points)
|
|
63
|
+
- [`set_plug_and_charge_charge_card`](#setplugandchargechargecard---set-the-charge-card-for-plug-and-charge)
|
|
62
64
|
- [`set_status`](#setstatus---enable-or-disable-a-charge-point)
|
|
63
65
|
- [Synchronous](#synchronous)
|
|
64
66
|
- [`login`](#login---log-in)
|
|
@@ -167,7 +169,7 @@ All the information returned by this endpoint is already included
|
|
|
167
169
|
in the response of [`get_charge_points`](#getchargepoints---get-your-charge-points).
|
|
168
170
|
|
|
169
171
|
```python
|
|
170
|
-
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict | str]
|
|
172
|
+
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict[str, Any] | str]
|
|
171
173
|
```
|
|
172
174
|
|
|
173
175
|
##### Arguments
|
|
@@ -228,6 +230,14 @@ async def get_sustainability_status(self) -> dict[str, float | int]
|
|
|
228
230
|
##### Returns
|
|
229
231
|
A dictionary with two keys: `{"trees": 1, "co2": 12.345}`
|
|
230
232
|
|
|
233
|
+
#### `set_plug_and_charge_charge_card` - Set the charge card for plug-and-charge
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
async def set_plug_and_charge_charge_card(self, evse_id: str, uid: str | None = None) -> None
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Sets the plug-and-charge card for the charge point. The uid must be a `uid` of one of your charge cards (see [`get_charge_cards`](#getchargecards---get-your-charge-cards)) or `None` to use no charge card.
|
|
240
|
+
|
|
231
241
|
#### `set_status` - Enable or disable a charge point.
|
|
232
242
|
|
|
233
243
|
```python
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
from asyncio import get_event_loop_policy, run
|
|
2
1
|
from os import environ
|
|
3
2
|
from typing import AsyncGenerator
|
|
4
3
|
|
|
5
4
|
from pytest import fixture, skip
|
|
6
|
-
from pytest_asyncio import fixture as async_fixture
|
|
7
5
|
|
|
8
6
|
from pybluecurrent import BlueCurrentClient
|
|
9
7
|
|
|
@@ -22,14 +20,6 @@ def client_with_auth() -> BlueCurrentClient | None:
|
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
@fixture(scope="session")
|
|
25
|
-
def event_loop():
|
|
26
|
-
policy = get_event_loop_policy()
|
|
27
|
-
loop = policy.new_event_loop()
|
|
28
|
-
yield loop
|
|
29
|
-
loop.close()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@async_fixture(scope="session")
|
|
33
23
|
async def connected_client() -> AsyncGenerator[BlueCurrentClient, None]:
|
|
34
24
|
try:
|
|
35
25
|
client = BlueCurrentClient(environ["BLUECURRENT_USERNAME"], environ["BLUECURRENT_PASSWORD"])
|
|
@@ -41,13 +31,8 @@ async def connected_client() -> AsyncGenerator[BlueCurrentClient, None]:
|
|
|
41
31
|
|
|
42
32
|
|
|
43
33
|
@fixture(scope="session")
|
|
44
|
-
def evse_id(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
charge_points = await client.get_charge_points()
|
|
48
|
-
return charge_points
|
|
49
|
-
|
|
50
|
-
result: list = run(_get_charge_points(client_with_auth))
|
|
51
|
-
if len(result) == 0:
|
|
34
|
+
async def evse_id(connected_client: BlueCurrentClient) -> str:
|
|
35
|
+
charge_points = await connected_client.get_charge_points()
|
|
36
|
+
if not charge_points:
|
|
52
37
|
skip("No charge points available.")
|
|
53
|
-
return
|
|
38
|
+
return charge_points[0]["evse_id"] # type: ignore
|
|
@@ -17,12 +17,10 @@ class TestHeaders:
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class TestAuthentication:
|
|
20
|
-
@mark.asyncio
|
|
21
20
|
async def test_authenticate(self, client_with_auth: BlueCurrentClient):
|
|
22
21
|
async with client_with_auth:
|
|
23
22
|
assert client_with_auth.token is not None
|
|
24
23
|
|
|
25
|
-
@mark.asyncio
|
|
26
24
|
async def test_authentication_failed(self, client: BlueCurrentClient):
|
|
27
25
|
with raises(AuthenticationFailed):
|
|
28
26
|
async with client:
|
|
@@ -34,13 +32,11 @@ class TestAuthentication:
|
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
class TestSocketApi:
|
|
37
|
-
@mark.asyncio
|
|
38
35
|
async def test_get_account(self, connected_client: BlueCurrentClient):
|
|
39
36
|
account = await connected_client.get_account()
|
|
40
37
|
assert "full_name" in account
|
|
41
38
|
assert isinstance(account["first_login_app"], date)
|
|
42
39
|
|
|
43
|
-
@mark.asyncio
|
|
44
40
|
async def test_get_charge_cards(self, connected_client: BlueCurrentClient):
|
|
45
41
|
charge_cards = await connected_client.get_charge_cards()
|
|
46
42
|
if len(charge_cards) == 0:
|
|
@@ -56,7 +52,6 @@ class TestSocketApi:
|
|
|
56
52
|
]
|
|
57
53
|
)
|
|
58
54
|
|
|
59
|
-
@mark.asyncio
|
|
60
55
|
async def test_get_charge_points(self, connected_client: BlueCurrentClient):
|
|
61
56
|
charge_points = await connected_client.get_charge_points()
|
|
62
57
|
if len(charge_points) == 0:
|
|
@@ -64,46 +59,67 @@ class TestSocketApi:
|
|
|
64
59
|
for charge_point in charge_points:
|
|
65
60
|
assert "evse_id" in charge_point
|
|
66
61
|
|
|
67
|
-
@mark.asyncio
|
|
68
62
|
async def test_get_grid_status(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
69
63
|
status = await connected_client.get_grid_status(evse_id=evse_id)
|
|
70
64
|
assert "grid_actual_p1" in status
|
|
71
65
|
assert "id" in status
|
|
72
66
|
|
|
73
|
-
@mark.asyncio
|
|
74
|
-
async def test_get_status(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
75
|
-
status = await connected_client.get_status(evse_id=evse_id)
|
|
76
|
-
assert status["evse_id"] == evse_id
|
|
77
|
-
|
|
78
|
-
@mark.asyncio
|
|
79
67
|
async def test_get_charge_point_settings(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
80
68
|
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
81
69
|
assert isinstance(settings, dict)
|
|
82
70
|
assert settings["evse_id"] == evse_id
|
|
83
71
|
|
|
84
|
-
@mark.asyncio
|
|
85
72
|
@mark.skip("Does not work")
|
|
86
73
|
async def test_get_sessions(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
87
74
|
sessions = await connected_client.get_sessions(evse_id=evse_id)
|
|
88
75
|
print(sessions)
|
|
89
76
|
|
|
90
|
-
@mark.asyncio
|
|
91
77
|
async def test_get_sustainability_status(self, connected_client: BlueCurrentClient):
|
|
92
78
|
sessions = await connected_client.get_sustainability_status()
|
|
93
79
|
assert set(sessions.keys()) == {"trees", "co2"}
|
|
94
80
|
|
|
95
|
-
@mark.asyncio
|
|
96
81
|
@mark.skip("Does not work.")
|
|
97
82
|
async def test_unlock_connector(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
98
83
|
result = await connected_client.unlock_connector(evse_id=evse_id)
|
|
99
84
|
print(result)
|
|
100
85
|
|
|
101
|
-
@mark.asyncio
|
|
102
86
|
@mark.skip("Do not change chargepoint status.")
|
|
103
87
|
async def test_soft_reset(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
104
88
|
_ = await connected_client.soft_reset(evse_id=evse_id)
|
|
105
89
|
|
|
106
|
-
@mark.
|
|
90
|
+
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
91
|
+
async def test_set_plug_and_charge_card(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
92
|
+
async def _get_plug_and_charge_card_uid() -> str | None:
|
|
93
|
+
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
94
|
+
try:
|
|
95
|
+
return settings["plug_and_charge_charge_card"]["uid"] # type: ignore
|
|
96
|
+
except KeyError:
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
# Get the original card, if any
|
|
100
|
+
before_card = await _get_plug_and_charge_card_uid()
|
|
101
|
+
|
|
102
|
+
# Get all possible cards, including no card
|
|
103
|
+
charge_cards = await connected_client.get_charge_cards()
|
|
104
|
+
if len(charge_cards) == 0:
|
|
105
|
+
skip(reason="No charge cards.")
|
|
106
|
+
uids: list[str | None] = [charge_card["uid"] for charge_card in charge_cards] + ["BCU_HOME_USE"] # type: ignore
|
|
107
|
+
# Set each card as plug_and_charge_card
|
|
108
|
+
for uid in uids:
|
|
109
|
+
if uid != before_card:
|
|
110
|
+
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid=uid)
|
|
111
|
+
assert await _get_plug_and_charge_card_uid() == uid
|
|
112
|
+
# Set the original card as plug_and_charge_card
|
|
113
|
+
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid=before_card)
|
|
114
|
+
assert await _get_plug_and_charge_card_uid() == before_card
|
|
115
|
+
|
|
116
|
+
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
117
|
+
async def test_set_invalid_plug_and_charge_card(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
118
|
+
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
119
|
+
with raises(BlueCurrentException):
|
|
120
|
+
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid="INVALID_CARD")
|
|
121
|
+
assert await connected_client.get_charge_point_settings(evse_id=evse_id) == settings
|
|
122
|
+
|
|
107
123
|
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
108
124
|
async def test_set_status(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
109
125
|
before_status = connected_client.get_charge_point_status(evse_id=evse_id)
|
|
@@ -114,7 +130,6 @@ class TestSocketApi:
|
|
|
114
130
|
await connected_client.set_status(evse_id=evse_id, enabled=True)
|
|
115
131
|
assert connected_client.get_charge_point_status(evse_id=evse_id)["activity"] == "available"
|
|
116
132
|
|
|
117
|
-
@mark.asyncio
|
|
118
133
|
async def test_error(self, connected_client: BlueCurrentClient):
|
|
119
134
|
with raises(BlueCurrentException) as e:
|
|
120
135
|
await connected_client.set_status("BCU123456", False)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# file generated by setuptools_scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
TYPE_CHECKING = False
|
|
4
|
-
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple, Union
|
|
6
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
-
else:
|
|
8
|
-
VERSION_TUPLE = object
|
|
9
|
-
|
|
10
|
-
version: str
|
|
11
|
-
__version__: str
|
|
12
|
-
__version_tuple__: VERSION_TUPLE
|
|
13
|
-
version_tuple: VERSION_TUPLE
|
|
14
|
-
|
|
15
|
-
__version__ = version = '0.0.2'
|
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 2)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|