Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 9d8212a

Browse files
committed
fixed type casts for set methods
1 parent e16a224 commit 9d8212a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ keywords = ["goecharger", "kfw", "api", "cloud"]
1818
name = "goechargerv2"
1919
readme = "README.md"
2020
requires-python = ">=3.7"
21-
version = "0.2.1"
21+
version = "0.2.2"
2222

2323
[project.optional-dependencies]
2424
dev = ["black", "pylint", "python-dotenv"]

src/goechargerv2/goecharger.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def __set_parameter(self, parameter, value) -> dict:
324324
):
325325
return {"success": False, "msg": "Request couldn't connect or timed out"}
326326

327-
def set_force_charging(self, allow) -> dict:
327+
def set_force_charging(self, allow: bool) -> dict:
328328
"""
329329
Sets the force charging.
330330
0 - neutral
@@ -336,41 +336,41 @@ def set_force_charging(self, allow) -> dict:
336336

337337
return self.__set_parameter("frc", 1)
338338

339-
def set_max_current(self, current) -> dict:
339+
def set_max_current(self, current: int) -> dict:
340340
"""
341341
Sets the current in Amperes. Minimum is 0, maximum is 32 Amperes.
342342
"""
343343
if current < 0:
344-
return self.__set_parameter("amp", str(0))
344+
return self.__set_parameter("amp", 0)
345345
if current > 32:
346-
return self.__set_parameter("amp", str(32))
346+
return self.__set_parameter("amp", 32)
347347

348-
return self.__set_parameter("amp", str(current))
348+
return self.__set_parameter("amp", current)
349349

350-
def set_phase(self, phase) -> dict | None:
350+
def set_phase(self, phase: int) -> dict | None:
351351
"""
352352
Sets the phase.
353353
0 - auto
354354
1 - 1 phase
355355
2 - 3 phases
356356
"""
357357
if phase in [0, 1, 2]:
358-
return self.__set_parameter("psm", str(phase))
358+
return self.__set_parameter("psm", phase)
359359

360360
raise ValueError(f"phase={phase} is unsupported")
361361

362-
def set_access_control(self, status) -> dict | None:
362+
def set_access_control(self, status: int) -> dict | None:
363363
"""
364364
Sets the access control.
365365
0 - open
366366
1 - wait
367367
"""
368368
if status in [0, 1]:
369-
return self.__set_parameter("acs", str(status))
369+
return self.__set_parameter("acs", status)
370370

371371
raise ValueError(f"access control status={status} is unsupported")
372372

373-
def set_transaction(self, status) -> dict | None:
373+
def set_transaction(self, status: int) -> dict | None:
374374
"""
375375
Sets the access control.
376376
None - no transaction
@@ -380,7 +380,7 @@ def set_transaction(self, status) -> dict | None:
380380
return self.__set_parameter("trx", None)
381381

382382
if status in [0]:
383-
return self.__set_parameter("trx", str(status))
383+
return self.__set_parameter("trx", status)
384384

385385
raise ValueError(f"transaction status={status} is unsupported")
386386

tests/goecharger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def json(self):
135135
REQUEST_RESPONSE_SET,
136136
**kwargs["params"],
137137
)
138-
print(REQUEST_RESPONSE_SET)
138+
139139
return MockResponse(
140140
REQUEST_RESPONSE_SET,
141141
200,

0 commit comments

Comments
 (0)