Skip to content

Commit

Permalink
feat(device): add support for TuYaERS10TZBVKAA
Browse files Browse the repository at this point in the history
related to #559
  • Loading branch information
xaviml committed Sep 12, 2022
1 parent c836980 commit 727346a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 7 deletions.
11 changes: 6 additions & 5 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 ]
64 changes: 62 additions & 2 deletions apps/controllerx/cx_devices/tuya.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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,
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 727346a

Please sign in to comment.