From 727346ab9edeac6482abced66ff42b9f1113e436 Mon Sep 17 00:00:00 2001 From: Xavier Moreno Date: Mon, 12 Sep 2022 18:48:13 +0200 Subject: [PATCH] feat(device): add support for TuYaERS10TZBVKAA related to #559 --- RELEASE_NOTES.md | 11 +-- apps/controllerx/cx_devices/tuya.py | 64 +++++++++++++++++- .../assets/controllers/TuYaERS10TZBVKAA.jpeg | Bin 0 -> 2487 bytes 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 docs/docs/assets/controllers/TuYaERS10TZBVKAA.jpeg diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 5673c81e..b04fb69d 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,7 +7,7 @@ _Note: Remember to restart the AppDaemon addon/server after updating to a new ve ## :pencil2: Features -- Add `Event` integration. This new integration allows us define the event we want to listen to, and which actions build from it. It is ideal for DYI devices. Read more about it [here](https://BASE_URL/controllerx/advanced/event-integration). +- Add `Event` integration. This new integration allows us define the event we want to listen to, and which actions build from it. It is ideal for DYI devices. Read more about it [here](https://BASE_URL/controllerx/advanced/event-integration). [ #568 ] ## :hammer: Fixes @@ -29,7 +29,8 @@ _Note: Remember to restart the AppDaemon addon/server after updating to a new ve - [E2002](https://BASE_URL/controllerx/controllers/E2002) - add Media Player support for ZHA. [ #531 ] @Langthjem - [SK5700002228949](https://BASE_URL/controllerx/controllers/SK5700002228949) - add Light support for deCONZ. [ #528 ] -- [WXCJKG11LM](https://BASE_URL/controllerx/controllers/WXCJKG11LM) - add deCONZ support for light controller [ #553 ] -- [WXKG07LM](https://BASE_URL/controllerx/controllers/WXKG07LM) - add Z2M Light Controller support [ #547 ] -- [PhilipsRDM002](https://BASE_URL/controllerx/controllers/PhilipsRDM002) - add support for light and Z2M Light controller [ #551 ] -- [WXKG15LM](https://BASE_URL/controllerx/controllers/WXKG15LM) - add support for light, Z2M Light and switch controller [ #560 ] @Crocmagnon +- [WXCJKG11LM](https://BASE_URL/controllerx/controllers/WXCJKG11LM) - add deCONZ support for Light controller. [ #553 ] +- [WXKG07LM](https://BASE_URL/controllerx/controllers/WXKG07LM) - add Z2M Light Controller support. [ #547 ] +- [PhilipsRDM002](https://BASE_URL/controllerx/controllers/PhilipsRDM002) - add support for Light and Z2M Light controller. [ #551 ] +- [WXKG15LM](https://BASE_URL/controllerx/controllers/WXKG15LM) - add support for Light, Z2M Light and Switch controller. [ #560 ] @Crocmagnon +- [TuYaERS10TZBVKAA](https://BASE_URL/controllerx/controllers/TuYaERS10TZBVKAA) - add support for Light, Z2M Light and Media Player controller. [ #559 ] diff --git a/apps/controllerx/cx_devices/tuya.py b/apps/controllerx/cx_devices/tuya.py index d813ada7..794d1082 100644 --- a/apps/controllerx/cx_devices/tuya.py +++ b/apps/controllerx/cx_devices/tuya.py @@ -1,5 +1,5 @@ -from cx_const import DefaultActionsMapping, Light -from cx_core import LightController +from cx_const import DefaultActionsMapping, Light, MediaPlayer, Z2MLight +from cx_core import LightController, MediaPlayerController, Z2MLightController class TS0044LightController(LightController): @@ -43,3 +43,63 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping: "3_double": Light.CLICK_BRIGHTNESS_UP, "3_hold": Light.CLICK_BRIGHTNESS_DOWN, } + + +class TuYaERS10TZBVKAALightController(LightController): + def get_z2m_actions_mapping(self) -> DefaultActionsMapping: + return { + # Command mode + "brightness_step_up": Light.CLICK_BRIGHTNESS_UP, + "brightness_step_down": Light.CLICK_BRIGHTNESS_DOWN, + "toggle": Light.TOGGLE, + "hue_move": Light.HOLD_BRIGHTNESS_TOGGLE, + "hue_stop": Light.RELEASE, + "color_temperature_step_up": Light.CLICK_COLOR_UP, + "color_temperature_step_down": Light.CLICK_COLOR_DOWN, + # Event mode + "rotate_left": Light.CLICK_BRIGHTNESS_DOWN, + "rotate_right": Light.CLICK_BRIGHTNESS_UP, + "single": Light.TOGGLE, + "double": Light.ON_FULL_BRIGHTNESS, + "hold": Light.ON_MIN_BRIGHTNESS, + } + + +class TuYaERS10TZBVKAAZ2MLightController(Z2MLightController): + def get_z2m_actions_mapping(self) -> DefaultActionsMapping: + return { + # Command mode + "brightness_step_up": Z2MLight.CLICK_BRIGHTNESS_UP, + "brightness_step_down": Z2MLight.CLICK_BRIGHTNESS_DOWN, + "toggle": Z2MLight.TOGGLE, + "hue_move": Z2MLight.HOLD_BRIGHTNESS_TOGGLE, + "hue_stop": Z2MLight.RELEASE, + "color_temperature_step_up": Z2MLight.CLICK_COLOR_TEMP_UP, + "color_temperature_step_down": Z2MLight.CLICK_COLOR_TEMP_DOWN, + # Event mode + "rotate_left": Z2MLight.CLICK_BRIGHTNESS_DOWN, + "rotate_right": Z2MLight.CLICK_BRIGHTNESS_UP, + "single": Z2MLight.TOGGLE, + "double": Z2MLight.ON_FULL_BRIGHTNESS, + "hold": Z2MLight.ON_MIN_BRIGHTNESS, + } + + +class TuYaERS10TZBVKAAMediaPlayerLightController(MediaPlayerController): + def get_z2m_actions_mapping(self) -> DefaultActionsMapping: + return { + # Command mode + "brightness_step_up": MediaPlayer.CLICK_VOLUME_UP, + "brightness_step_down": MediaPlayer.CLICK_VOLUME_DOWN, + "toggle": MediaPlayer.PLAY_PAUSE, + "hue_move": MediaPlayer.HOLD_VOLUME_UP, + "hue_stop": Z2MLight.RELEASE, + "color_temperature_step_up": MediaPlayer.NEXT_TRACK, + "color_temperature_step_down": MediaPlayer.PREVIOUS_TRACK, + # Event mode + "rotate_left": MediaPlayer.CLICK_VOLUME_DOWN, + "rotate_right": MediaPlayer.CLICK_VOLUME_UP, + "single": MediaPlayer.PLAY_PAUSE, + "double": MediaPlayer.NEXT_TRACK, + "hold": MediaPlayer.PREVIOUS_TRACK, + } diff --git a/docs/docs/assets/controllers/TuYaERS10TZBVKAA.jpeg b/docs/docs/assets/controllers/TuYaERS10TZBVKAA.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..1f7adcd77b053a2389aca69fa84f98b0da5c882f GIT binary patch literal 2487 zcmb7Fc{tQv8~%+kMueHMWR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