Skip to content

Commit

Permalink
Add support for identify and system for HWE-WTR (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
DCSBL authored Mar 19, 2024
1 parent 1a25767 commit 771eede
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 26 deletions.
10 changes: 1 addition & 9 deletions homewizard_energy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,5 @@
SUPPORTED_API_VERSION = "v1"

SUPPORTS_STATE = ["HWE-SKT"]
SUPPORTS_IDENTIFY = ["HWE-SKT", "HWE-P1"]
SUPPORTS_SYSTEM = [
"HWE-SKT",
"HWE-P1",
"HWE-KWH1",
"HWE-KWH3",
"SDM230-wifi",
"SDM630-wifi",
]
SUPPORTS_IDENTIFY = ["HWE-SKT", "HWE-P1", "HWE-WTR"]
SUPPORTS_DECRYPTION = ["HWE-P1"]
39 changes: 27 additions & 12 deletions tests/__snapshots__/test_homewizard_energy.ambr

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions tests/__snapshots__/test_models.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
# name: test_state[HWE-SKT-fixtures0].3
State(power_on=None, switch_lock=None, brightness=255)
# ---
# name: test_system[HWE-KWH1-fixtures2]
# name: test_system[HWE-KWH1-fixtures3]
System(cloud_enabled=True)
# ---
# name: test_system[HWE-KWH3-fixtures3]
# name: test_system[HWE-KWH3-fixtures4]
System(cloud_enabled=True)
# ---
# name: test_system[HWE-P1-fixtures0]
Expand All @@ -77,9 +77,12 @@
# name: test_system[HWE-SKT-fixtures1]
System(cloud_enabled=True)
# ---
# name: test_system[SDM230-wifi-fixtures4]
# name: test_system[HWE-WTR-fixtures2]
System(cloud_enabled=True)
# ---
# name: test_system[SDM630-wifi-fixtures5]
# name: test_system[SDM230-wifi-fixtures5]
System(cloud_enabled=True)
# ---
# name: test_system[SDM630-wifi-fixtures6]
System(cloud_enabled=True)
# ---
1 change: 1 addition & 0 deletions tests/fixtures/HWE-WTR/identify.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"identify": "ok"}
3 changes: 3 additions & 0 deletions tests/fixtures/HWE-WTR/system.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cloud_enabled": true
}
6 changes: 5 additions & 1 deletion tests/test_homewizard_energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ async def test_request_detects_clienterror():
[
("HWE-P1", ["device"]),
("HWE-SKT", ["device"]),
("HWE-WTR", ["device"]),
("HWE-KWH1", ["device"]),
("HWE-KWH3", ["device"]),
("SDM230-wifi", ["device"]),
Expand Down Expand Up @@ -199,6 +200,7 @@ async def test_get_device_object_detects_invalid_api(aresponses):
["data_all_data", "data_minimal", "data_no_gas", "data_single_phase"],
),
("HWE-SKT", ["data"]),
("HWE-WTR", ["data"]),
("HWE-KWH1", ["data"]),
("HWE-KWH3", ["data"]),
("SDM230-wifi", ["data"]),
Expand Down Expand Up @@ -251,6 +253,7 @@ async def test_get_data_object(
["data_all_data", "data_minimal", "data_no_gas", "data_single_phase"],
),
("HWE-SKT", ["data"]),
("HWE-WTR", ["data"]),
("HWE-KWH1", ["data"]),
("HWE-KWH3", ["data"]),
("SDM230-wifi", ["data"]),
Expand Down Expand Up @@ -385,6 +388,7 @@ async def test_state_set_detects_no_statechange():
[
"HWE-P1",
"HWE-SKT",
"HWE-WTR",
],
)
async def test_identify(model: str, snapshot: SnapshotAssertion, aresponses):
Expand Down Expand Up @@ -414,7 +418,6 @@ async def test_identify(model: str, snapshot: SnapshotAssertion, aresponses):
@pytest.mark.parametrize(
"model",
[
"HWE-WTR",
"HWE-KWH1",
"HWE-KWH3",
"SDM230-wifi",
Expand Down Expand Up @@ -510,6 +513,7 @@ async def test_get_system_object(aresponses):
[
"HWE-P1",
"HWE-SKT",
"HWE-WTR",
"HWE-KWH1",
"HWE-KWH3",
"SDM230-wifi",
Expand Down
1 change: 1 addition & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ async def test_state(model: str, fixtures: str, snapshot: SnapshotAssertion):
[
("HWE-P1", ["system"]),
("HWE-SKT", ["system"]),
("HWE-WTR", ["system"]),
("HWE-KWH1", ["system"]),
("HWE-KWH3", ["system"]),
("SDM230-wifi", ["system"]),
Expand Down

0 comments on commit 771eede

Please sign in to comment.