From 9fb6f905ee4b53757d8227598806a87a34ef95d3 Mon Sep 17 00:00:00 2001 From: Strauman Date: Thu, 17 Oct 2024 22:03:25 +0200 Subject: [PATCH 1/4] Add TS0043 to ZHA --- apps/controllerx/cx_devices/tuya.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps/controllerx/cx_devices/tuya.py b/apps/controllerx/cx_devices/tuya.py index 37a09c18..50da212e 100644 --- a/apps/controllerx/cx_devices/tuya.py +++ b/apps/controllerx/cx_devices/tuya.py @@ -44,6 +44,31 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping: "3_double": Light.CLICK_BRIGHTNESS_UP, "3_hold": Light.CLICK_BRIGHTNESS_DOWN, } + + def get_zha_actions_mapping(self) -> DefaultActionsMapping: + return { + "1_remote_button_short_press": Light.TOGGLE, + "1_remote_button_double_press": Light.CLICK_BRIGHTNESS_UP, + "1_remote_button_long_press": Light.CLICK_BRIGHTNESS_DOWN, + "2_remote_button_short_press": Light.TOGGLE, + "2_remote_button_double_press": Light.CLICK_BRIGHTNESS_UP, + "2_remote_button_long_press": Light.CLICK_BRIGHTNESS_DOWN, + "3_remote_button_short_press": Light.TOGGLE, + "3_remote_button_double_press": Light.CLICK_BRIGHTNESS_UP, + "3_remote_button_long_press": Light.CLICK_BRIGHTNESS_DOWN, + } + + def get_zha_action(self, data: EventData) -> str: + args: str = "" + # Command is {endpoint_id}_{command} + if len(data["args"]) > 0: + if isinstance(data["args"], list): + args = "_" + "_".join([str(d) for d in data["args"]]) + else: + args = args + f"{data['args']}" + command: str = f"{data['endpoint_id']}_{data['command']}{args}" + return command + class TuYaERS10TZBVKAALightController(LightController): @@ -117,3 +142,4 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping: "double": MediaPlayer.NEXT_TRACK, "hold": MediaPlayer.PREVIOUS_TRACK, } + From 938c6c579f728b57a1c5cbb4cd1f49f1f05fb691 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:05:43 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- apps/controllerx/cx_devices/tuya.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/controllerx/cx_devices/tuya.py b/apps/controllerx/cx_devices/tuya.py index 50da212e..36e75445 100644 --- a/apps/controllerx/cx_devices/tuya.py +++ b/apps/controllerx/cx_devices/tuya.py @@ -44,7 +44,7 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping: "3_double": Light.CLICK_BRIGHTNESS_UP, "3_hold": Light.CLICK_BRIGHTNESS_DOWN, } - + def get_zha_actions_mapping(self) -> DefaultActionsMapping: return { "1_remote_button_short_press": Light.TOGGLE, @@ -70,7 +70,6 @@ def get_zha_action(self, data: EventData) -> str: return command - class TuYaERS10TZBVKAALightController(LightController): def get_z2m_actions_mapping(self) -> DefaultActionsMapping: return { @@ -142,4 +141,3 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping: "double": MediaPlayer.NEXT_TRACK, "hold": MediaPlayer.PREVIOUS_TRACK, } - From 48e86a0c424485e0e1714732eefd3494c6b3c13e Mon Sep 17 00:00:00 2001 From: Xavi Date: Fri, 8 Nov 2024 16:29:02 +0100 Subject: [PATCH 3/4] docs(release_notes): Add TS0043 to release notes related to #1066 --- RELEASE_NOTES.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c00f347e..a2ffb5f8 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -10,11 +10,9 @@ _This minor change does not contain any breaking changes._ ## :pencil2: Features --> - +- [TS0043](https://BASE_URL/controllerx/controllers/TS0043) - add ZHA support. [ #1066 ]