Skip to content

Commit

Permalink
fix(device): ZHA intgegration for WXKG11LMLightController
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviml committed Oct 28, 2020
1 parent 5a71002 commit 8bf2a41
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/controllerx/cx_devices/aqara.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_zha_action(self, data: dict) -> str:
4: "quadruple",
}
clicks = data["args"]["value"]
return mapping[clicks]
return mapping.get(clicks, "")


class WXKG12LMLightController(LightController):
Expand Down
22 changes: 21 additions & 1 deletion tests/unit_tests/cx_devices/aqara_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import pytest
from cx_devices.aqara import MFKZQ01LMLightController, WXKG01LMLightController
from cx_devices.aqara import (
MFKZQ01LMLightController,
WXKG01LMLightController,
WXKG11LMLightController,
)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -34,3 +38,19 @@ def test_zha_action_WXKG01LMLightController(data, expected_action):
sut = WXKG01LMLightController()
action = sut.get_zha_action(data)
assert action == expected_action


@pytest.mark.parametrize(
"data, expected_action",
[
({"args": {"value": 0}}, ""),
({"args": {"value": 1}}, "single"),
({"args": {"value": 2}}, "double"),
({"args": {"value": 3}}, "triple"),
({"args": {"value": 4}}, "quadruple"),
],
)
def test_zha_action_WXKG11LMLightController(data, expected_action):
sut = WXKG11LMLightController()
action = sut.get_zha_action(data)
assert action == expected_action

0 comments on commit 8bf2a41

Please sign in to comment.