pybluecurrent 0.0.3__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.3 → pybluecurrent-0.0.4}/.pre-commit-config.yaml +2 -2
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/PKG-INFO +5 -4
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/pyproject.toml +6 -1
- pybluecurrent-0.0.4/src/pybluecurrent/_version.py +34 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent/client.py +9 -2
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/PKG-INFO +5 -4
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/requires.txt +2 -2
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/tests/conftest.py +4 -19
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/tests/test_client.py +1 -16
- pybluecurrent-0.0.3/src/pybluecurrent/_version.py +0 -16
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/.github/workflows/publish.yaml +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/.github/workflows/test.yaml +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/.gitignore +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/LICENSE +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/README.md +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/setup.cfg +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent/__init__.py +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent/exceptions.py +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent/py.typed +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent/utilities.py +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/SOURCES.txt +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/dependency_links.txt +0 -0
- {pybluecurrent-0.0.3 → pybluecurrent-0.0.4}/src/pybluecurrent.egg-info/top_level.txt +0 -0
- {pybluecurrent-0.0.3 → 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==8.
|
|
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
|
|
|
@@ -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==8.
|
|
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'
|
|
@@ -212,10 +212,17 @@ class BlueCurrentClient:
|
|
|
212
212
|
|
|
213
213
|
Args:
|
|
214
214
|
evse_id: A charge point ID.
|
|
215
|
-
uid: A charge card UID or None
|
|
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.
|
|
216
221
|
"""
|
|
222
|
+
token_uid = "BCU-APP" if uid is None or uid == "BCU_HOME_USE" else uid
|
|
217
223
|
await self._send(
|
|
218
|
-
dict(command="SET_PLUG_AND_CHARGE_CHARGE_CARD", evse_id=evse_id, token_uid=
|
|
224
|
+
dict(command="SET_PLUG_AND_CHARGE_CHARGE_CARD", evse_id=evse_id, token_uid=token_uid),
|
|
225
|
+
token=True,
|
|
219
226
|
)
|
|
220
227
|
result = await self._receive("STATUS_SET_PLUG_AND_CHARGE_CHARGE_CARD")
|
|
221
228
|
if not result.get("success"):
|
|
@@ -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==8.
|
|
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
|
|
|
@@ -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,41 +59,34 @@ 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
67
|
async def test_get_charge_point_settings(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
75
68
|
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
76
69
|
assert isinstance(settings, dict)
|
|
77
70
|
assert settings["evse_id"] == evse_id
|
|
78
71
|
|
|
79
|
-
@mark.asyncio
|
|
80
72
|
@mark.skip("Does not work")
|
|
81
73
|
async def test_get_sessions(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
82
74
|
sessions = await connected_client.get_sessions(evse_id=evse_id)
|
|
83
75
|
print(sessions)
|
|
84
76
|
|
|
85
|
-
@mark.asyncio
|
|
86
77
|
async def test_get_sustainability_status(self, connected_client: BlueCurrentClient):
|
|
87
78
|
sessions = await connected_client.get_sustainability_status()
|
|
88
79
|
assert set(sessions.keys()) == {"trees", "co2"}
|
|
89
80
|
|
|
90
|
-
@mark.asyncio
|
|
91
81
|
@mark.skip("Does not work.")
|
|
92
82
|
async def test_unlock_connector(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
93
83
|
result = await connected_client.unlock_connector(evse_id=evse_id)
|
|
94
84
|
print(result)
|
|
95
85
|
|
|
96
|
-
@mark.asyncio
|
|
97
86
|
@mark.skip("Do not change chargepoint status.")
|
|
98
87
|
async def test_soft_reset(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
99
88
|
_ = await connected_client.soft_reset(evse_id=evse_id)
|
|
100
89
|
|
|
101
|
-
@mark.asyncio
|
|
102
90
|
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
103
91
|
async def test_set_plug_and_charge_card(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
104
92
|
async def _get_plug_and_charge_card_uid() -> str | None:
|
|
@@ -115,7 +103,7 @@ class TestSocketApi:
|
|
|
115
103
|
charge_cards = await connected_client.get_charge_cards()
|
|
116
104
|
if len(charge_cards) == 0:
|
|
117
105
|
skip(reason="No charge cards.")
|
|
118
|
-
uids: list[str | None] = [charge_card["uid"] for charge_card in charge_cards] + [
|
|
106
|
+
uids: list[str | None] = [charge_card["uid"] for charge_card in charge_cards] + ["BCU_HOME_USE"] # type: ignore
|
|
119
107
|
# Set each card as plug_and_charge_card
|
|
120
108
|
for uid in uids:
|
|
121
109
|
if uid != before_card:
|
|
@@ -125,7 +113,6 @@ class TestSocketApi:
|
|
|
125
113
|
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid=before_card)
|
|
126
114
|
assert await _get_plug_and_charge_card_uid() == before_card
|
|
127
115
|
|
|
128
|
-
@mark.asyncio
|
|
129
116
|
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
130
117
|
async def test_set_invalid_plug_and_charge_card(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
131
118
|
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
@@ -133,7 +120,6 @@ class TestSocketApi:
|
|
|
133
120
|
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid="INVALID_CARD")
|
|
134
121
|
assert await connected_client.get_charge_point_settings(evse_id=evse_id) == settings
|
|
135
122
|
|
|
136
|
-
@mark.asyncio
|
|
137
123
|
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
138
124
|
async def test_set_status(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
139
125
|
before_status = connected_client.get_charge_point_status(evse_id=evse_id)
|
|
@@ -144,7 +130,6 @@ class TestSocketApi:
|
|
|
144
130
|
await connected_client.set_status(evse_id=evse_id, enabled=True)
|
|
145
131
|
assert connected_client.get_charge_point_status(evse_id=evse_id)["activity"] == "available"
|
|
146
132
|
|
|
147
|
-
@mark.asyncio
|
|
148
133
|
async def test_error(self, connected_client: BlueCurrentClient):
|
|
149
134
|
with raises(BlueCurrentException) as e:
|
|
150
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.3'
|
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 3)
|
|
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
|
|
File without changes
|