Skip to content

Commit

Permalink
Adds TS0044F Tuya device (#385)
Browse files Browse the repository at this point in the history
* Adds TS0044F Tuya device

Little different than the TS0044 Tuya device already implemented

* style(black): format code with black

Co-authored-by: Xavi Moreno <[email protected]>
  • Loading branch information
francoisauclair911 and xaviml authored Jan 1, 2022
1 parent bec6770 commit 9f9412a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
5 changes: 1 addition & 4 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ PRERELEASE_NOTE
## :wrench: Refactor
-->

<!--
## :video_game: New devices

- [WXKG06LM](https://xaviml.github.io/controllerx/controllers/WXKG06LM) - add Z2M and deCONZ support
- [W2049](https://xaviml.github.io/controllerx/controllers/W2049) - add ZHA support @patrezp [#375]
-->
- [TS0044F](https://xaviml.github.io/controllerx/controllers/TS0044F) - add Z2M support
10 changes: 10 additions & 0 deletions apps/controllerx/cx_devices/tuya.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
"4_double": Light.CLICK_BRIGHTNESS_UP,
"4_hold": Light.CLICK_BRIGHTNESS_DOWN,
}


class TS0044FLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"off": Light.TOGGLE,
"brightness_step_up": Light.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Light.CLICK_BRIGHTNESS_DOWN,
}
28 changes: 28 additions & 0 deletions docs/_data/controllers/TS0044F.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: TS0044F (TuYa)
device_support:
- type: Light
domain: light
controller: TS0044FLightController
delay: 350
mapping:
- "Click top left → Toggle"
- "Click top right → Brighten up (1 step)"
- "Click bottom left → Toggle"
- "Click bottom right → Dim down (1 step)"
integrations:
- name: Zigbee2MQTT
codename: z2m
actions:
- on → Click top left
- brightness_step_up → Click top right
- off → Click bottom left
- brightness_step_down → Click top right
note: >-
This device is very similar to the TS0044 Tuya, except that it doesn't hold action, double clicks.
Note that each button perform the same actions.
This is because ControllerX is design to control just one entity (light or media player).
So you can include the `actions` parameter to include the actions needed,
or use the `mapping` attribute to define a <a href="/controllerx/advanced/custom-controllers">custom mapping</a>.
You can check <a href="https://github.com/xaviml/controllerx/issues/18#issuecomment-582535634">here</a> for reference.
Also, this controller doesn't support hold action. This means that there is not
smooth brightness changes when holding, just step by step everytime it's pressed.
Binary file added docs/assets/img/TS0044F.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/controllers/TS0044F.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
layout: controller
title: TS0044F (TuYa)
device: TS0044F
---

0 comments on commit 9f9412a

Please sign in to comment.