Skip to content

Commit 1b6bcae

Browse files
authored
fix: change set_divert_mode to use http post (#432)
* fix: change `set_divert_mode` to use http post * fix tests
1 parent 86893a8 commit 1b6bcae

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

openevsehttp/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ async def set_divert_mode(self, mode: str = "fast") -> None:
887887
new_mode = divert_mode[mode]
888888
data = {"divertmode": new_mode}
889889
response = await self.process_request(
890-
url=url, method="get", data=data
890+
url=url, method="post", data=data
891891
) # noqa: E501
892892
if response != "Divert Mode changed":
893893
_LOGGER.error("Problem issuing command: %s", response)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
PROJECT_DIR = Path(__file__).parent.resolve()
88
README_FILE = PROJECT_DIR / "README.md"
9-
VERSION = "0.1.80"
9+
VERSION = "0.1.81"
1010

1111
setup(
1212
name="python_openevse_http",

tests/test_main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2173,7 +2173,7 @@ async def test_set_divert_mode(
21732173
"""Test set_divert_mode reply."""
21742174
await test_charger_new.update()
21752175
value = "Divert Mode changed"
2176-
mock_aioclient.get(
2176+
mock_aioclient.post(
21772177
TEST_URL_DIVERT,
21782178
status=200,
21792179
body=value,
@@ -2182,7 +2182,7 @@ async def test_set_divert_mode(
21822182
await test_charger_new.set_divert_mode("fast")
21832183
assert "Setting divert mode to fast" in caplog.text
21842184

2185-
mock_aioclient.get(
2185+
mock_aioclient.post(
21862186
TEST_URL_DIVERT,
21872187
status=200,
21882188
body=value,
@@ -2197,7 +2197,7 @@ async def test_set_divert_mode(
21972197
await test_charger_new.set_divert_mode("test")
21982198
assert "Invalid value for charge_mode: test" in caplog.text
21992199

2200-
mock_aioclient.get(
2200+
mock_aioclient.post(
22012201
TEST_URL_DIVERT,
22022202
status=200,
22032203
body="error",

0 commit comments

Comments
 (0)