pybluecurrent 0.0.2__tar.gz → 0.0.3__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.3}/PKG-INFO +13 -4
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/README.md +10 -1
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/pyproject.toml +1 -1
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent/_version.py +2 -2
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent/client.py +17 -7
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent.egg-info/PKG-INFO +13 -4
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent.egg-info/requires.txt +2 -2
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/tests/test_client.py +35 -5
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/.github/workflows/publish.yaml +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/.github/workflows/test.yaml +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/.gitignore +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/.pre-commit-config.yaml +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/LICENSE +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/setup.cfg +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent/__init__.py +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent/exceptions.py +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent/py.typed +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent/utilities.py +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent.egg-info/SOURCES.txt +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent.egg-info/dependency_links.txt +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/src/pybluecurrent.egg-info/top_level.txt +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/tests/conftest.py +0 -0
- {pybluecurrent-0.0.2 → pybluecurrent-0.0.3}/tests/test_utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pybluecurrent
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
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,8 @@ 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.1.2; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-asyncio==0.21.1; extra == "dev"
|
|
26
26
|
|
|
27
27
|
# pybluecurrent
|
|
28
28
|
|
|
@@ -59,6 +59,7 @@ As a result, the `BlueCurrentClient` also exposes synchronous as well as asynchr
|
|
|
59
59
|
- [`get_charge_point_settings`](#getchargepointsettings---get-the-settings-of-a-charge-point)
|
|
60
60
|
- [`get_grid_status`](#getgridstatus---get-the-grid-status-associated-to-a-charge-point)
|
|
61
61
|
- [`get_sustainability_status`](#getsustainabilitystatus---get-statistics-on-the-sustainability-of-all-your-charge-points)
|
|
62
|
+
- [`set_plug_and_charge_charge_card`](#setplugandchargechargecard---set-the-charge-card-for-plug-and-charge)
|
|
62
63
|
- [`set_status`](#setstatus---enable-or-disable-a-charge-point)
|
|
63
64
|
- [Synchronous](#synchronous)
|
|
64
65
|
- [`login`](#login---log-in)
|
|
@@ -167,7 +168,7 @@ All the information returned by this endpoint is already included
|
|
|
167
168
|
in the response of [`get_charge_points`](#getchargepoints---get-your-charge-points).
|
|
168
169
|
|
|
169
170
|
```python
|
|
170
|
-
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict | str]
|
|
171
|
+
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict[str, Any] | str]
|
|
171
172
|
```
|
|
172
173
|
|
|
173
174
|
##### Arguments
|
|
@@ -228,6 +229,14 @@ async def get_sustainability_status(self) -> dict[str, float | int]
|
|
|
228
229
|
##### Returns
|
|
229
230
|
A dictionary with two keys: `{"trees": 1, "co2": 12.345}`
|
|
230
231
|
|
|
232
|
+
#### `set_plug_and_charge_charge_card` - Set the charge card for plug-and-charge
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
async def set_plug_and_charge_charge_card(self, evse_id: str, uid: str | None = None) -> None
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
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.
|
|
239
|
+
|
|
231
240
|
#### `set_status` - Enable or disable a charge point.
|
|
232
241
|
|
|
233
242
|
```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.1.2", "pytest-asyncio==0.21.1"]
|
|
36
36
|
|
|
37
37
|
[project.urls]
|
|
38
38
|
Repository = "https://github.com/rogiervandergeer/pybluecurrent"
|
|
@@ -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,21 @@ 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 (for no charge card). Defaults to None.
|
|
216
|
+
"""
|
|
217
|
+
await self._send(
|
|
218
|
+
dict(command="SET_PLUG_AND_CHARGE_CHARGE_CARD", evse_id=evse_id, token_uid=uid or "BCU-APP"), token=True
|
|
219
|
+
)
|
|
220
|
+
result = await self._receive("STATUS_SET_PLUG_AND_CHARGE_CHARGE_CARD")
|
|
221
|
+
if not result.get("success"):
|
|
222
|
+
raise BlueCurrentException(result)
|
|
223
|
+
|
|
214
224
|
async def set_status(self, evse_id: str, enabled: bool) -> None:
|
|
215
225
|
"""
|
|
216
226
|
Enable or disable a charge point.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pybluecurrent
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
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,8 @@ 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.1.2; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-asyncio==0.21.1; extra == "dev"
|
|
26
26
|
|
|
27
27
|
# pybluecurrent
|
|
28
28
|
|
|
@@ -59,6 +59,7 @@ As a result, the `BlueCurrentClient` also exposes synchronous as well as asynchr
|
|
|
59
59
|
- [`get_charge_point_settings`](#getchargepointsettings---get-the-settings-of-a-charge-point)
|
|
60
60
|
- [`get_grid_status`](#getgridstatus---get-the-grid-status-associated-to-a-charge-point)
|
|
61
61
|
- [`get_sustainability_status`](#getsustainabilitystatus---get-statistics-on-the-sustainability-of-all-your-charge-points)
|
|
62
|
+
- [`set_plug_and_charge_charge_card`](#setplugandchargechargecard---set-the-charge-card-for-plug-and-charge)
|
|
62
63
|
- [`set_status`](#setstatus---enable-or-disable-a-charge-point)
|
|
63
64
|
- [Synchronous](#synchronous)
|
|
64
65
|
- [`login`](#login---log-in)
|
|
@@ -167,7 +168,7 @@ All the information returned by this endpoint is already included
|
|
|
167
168
|
in the response of [`get_charge_points`](#getchargepoints---get-your-charge-points).
|
|
168
169
|
|
|
169
170
|
```python
|
|
170
|
-
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict | str]
|
|
171
|
+
async def get_charge_point_settings(self, evse_id: str) -> dict[str, bool | dict[str, Any] | str]
|
|
171
172
|
```
|
|
172
173
|
|
|
173
174
|
##### Arguments
|
|
@@ -228,6 +229,14 @@ async def get_sustainability_status(self) -> dict[str, float | int]
|
|
|
228
229
|
##### Returns
|
|
229
230
|
A dictionary with two keys: `{"trees": 1, "co2": 12.345}`
|
|
230
231
|
|
|
232
|
+
#### `set_plug_and_charge_charge_card` - Set the charge card for plug-and-charge
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
async def set_plug_and_charge_charge_card(self, evse_id: str, uid: str | None = None) -> None
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
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.
|
|
239
|
+
|
|
231
240
|
#### `set_status` - Enable or disable a charge point.
|
|
232
241
|
|
|
233
242
|
```python
|
|
@@ -70,11 +70,6 @@ class TestSocketApi:
|
|
|
70
70
|
assert "grid_actual_p1" in status
|
|
71
71
|
assert "id" in status
|
|
72
72
|
|
|
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
73
|
@mark.asyncio
|
|
79
74
|
async def test_get_charge_point_settings(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
80
75
|
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
@@ -103,6 +98,41 @@ class TestSocketApi:
|
|
|
103
98
|
async def test_soft_reset(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
104
99
|
_ = await connected_client.soft_reset(evse_id=evse_id)
|
|
105
100
|
|
|
101
|
+
@mark.asyncio
|
|
102
|
+
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
103
|
+
async def test_set_plug_and_charge_card(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
104
|
+
async def _get_plug_and_charge_card_uid() -> str | None:
|
|
105
|
+
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
106
|
+
try:
|
|
107
|
+
return settings["plug_and_charge_charge_card"]["uid"] # type: ignore
|
|
108
|
+
except KeyError:
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
# Get the original card, if any
|
|
112
|
+
before_card = await _get_plug_and_charge_card_uid()
|
|
113
|
+
|
|
114
|
+
# Get all possible cards, including no card
|
|
115
|
+
charge_cards = await connected_client.get_charge_cards()
|
|
116
|
+
if len(charge_cards) == 0:
|
|
117
|
+
skip(reason="No charge cards.")
|
|
118
|
+
uids: list[str | None] = [charge_card["uid"] for charge_card in charge_cards] + [None] # type: ignore
|
|
119
|
+
# Set each card as plug_and_charge_card
|
|
120
|
+
for uid in uids:
|
|
121
|
+
if uid != before_card:
|
|
122
|
+
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid=uid)
|
|
123
|
+
assert await _get_plug_and_charge_card_uid() == uid
|
|
124
|
+
# Set the original card as plug_and_charge_card
|
|
125
|
+
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid=before_card)
|
|
126
|
+
assert await _get_plug_and_charge_card_uid() == before_card
|
|
127
|
+
|
|
128
|
+
@mark.asyncio
|
|
129
|
+
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
130
|
+
async def test_set_invalid_plug_and_charge_card(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
131
|
+
settings = await connected_client.get_charge_point_settings(evse_id=evse_id)
|
|
132
|
+
with raises(BlueCurrentException):
|
|
133
|
+
await connected_client.set_plug_and_charge_charge_card(evse_id=evse_id, uid="INVALID_CARD")
|
|
134
|
+
assert await connected_client.get_charge_point_settings(evse_id=evse_id) == settings
|
|
135
|
+
|
|
106
136
|
@mark.asyncio
|
|
107
137
|
@mark.skipif(environ.get("BLUECURRENT_READ_ONLY", "TRUE") != "FALSE", reason="Running read-only tests.")
|
|
108
138
|
async def test_set_status(self, connected_client: BlueCurrentClient, evse_id: str):
|
|
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
|
|
File without changes
|