Skip to content

Commit

Permalink
fix(device): ZHA parser for WXKG01LMLightController
Browse files Browse the repository at this point in the history
related to #241
  • Loading branch information
xaviml committed Feb 7, 2021
1 parent 55611fb commit 945efbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/controllerx/cx_devices/aqara.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def get_zha_actions_mapping(self) -> DefaultActionsMapping:
}

def get_zha_action(self, data: EventData) -> str:
return data["args"]["click_type"]
args = data["args"]
if "click_type" in args:
return args["click_type"]
return data["command"]


class WXKG11LMRemoteLightController(LightController):
Expand Down
4 changes: 4 additions & 0 deletions tests/unit_tests/cx_devices/aqara_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def test_zha_action_MFKZQ01LMLightController(data: EventData, expected_action: s
({"command": "click", "args": {"click_type": "triple"}}, "triple"),
({"command": "click", "args": {"click_type": "quadruple"}}, "quadruple"),
({"command": "click", "args": {"click_type": "furious"}}, "furious"),
(
{"command": "attribute_updated", "args": {"value": True}},
"attribute_updated",
),
],
)
def test_zha_action_WXKG01LMLightController(data: EventData, expected_action: str):
Expand Down

0 comments on commit 945efbd

Please sign in to comment.