Skip to content

Commit 268fb2b

Browse files
authored
fix: send_command return value incorrect (firstof9#5)
* fix: url and form data * fix tests * formatting * fix: send_command return value incorrect
1 parent dd3e85c commit 268fb2b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

openevsehttp/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def send_command(self, command: str) -> tuple | None:
6868
if "ret" not in value.json():
6969
return False, ""
7070
resp = value.json()
71-
return resp["cmd"] == "OK", resp["ret"]
71+
return resp["cmd"], resp["ret"]
7272

7373
def update(self) -> None:
7474
"""Update the values."""

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
PROJECT_DIR = Path(__file__).parent.resolve()
77
README_FILE = PROJECT_DIR / "README.md"
8-
VERSION = "0.1.5"
8+
VERSION = "0.1.6"
99

1010

1111
setup(

tests/test_init.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def test_get_status_auth_err(test_charger_auth_err):
1919
def test_send_command(test_charger, send_command_mock):
2020
"""Test v4 Status reply"""
2121
status = test_charger.send_command("test")
22-
assert status == (True, "$OK^20")
22+
assert status == ("OK", "$OK^20")
2323

2424

25-
def test_send_command(test_charger, send_command_mock_failed):
25+
def test_send_command_failed(test_charger, send_command_mock_failed):
2626
"""Test v4 Status reply"""
2727
status = test_charger.send_command("test")
28-
assert status == (True, "$NK^21")
28+
assert status == ("OK", "$NK^21")
2929

3030

3131
def test_send_command_missing(test_charger, send_command_mock_missing):
@@ -37,7 +37,7 @@ def test_send_command_missing(test_charger, send_command_mock_missing):
3737
def test_send_command_auth(test_charger_auth, send_command_mock):
3838
"""Test v4 Status reply"""
3939
status = test_charger_auth.send_command("test")
40-
assert status == (True, "$OK^20")
40+
assert status == ("OK", "$OK^20")
4141

4242

4343
def test_send_command_parse_err(test_charger_auth, send_command_parse_err):

0 commit comments

Comments
 (0)