diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index dfb4167f..fb0e54f8 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -26,3 +26,4 @@ _PRERELEASE_NOTE_ ## :video_game: New devices - [HG06323](https://xaviml.github.io/controllerx/controllers/HG06323) - add ZHA support [ #274 ] @Thomas55555 +- [TS0044](https://xaviml.github.io/controllerx/controllers/TS0044) - add device with Z2M support [ #240 ] diff --git a/apps/controllerx/controllerx.py b/apps/controllerx/controllerx.py index 0b52fea7..503cee8e 100644 --- a/apps/controllerx/controllerx.py +++ b/apps/controllerx/controllerx.py @@ -29,3 +29,4 @@ from cx_devices.sonoff import * from cx_devices.terncy import * from cx_devices.trust import * +from cx_devices.tuya import * diff --git a/apps/controllerx/cx_devices/tuya.py b/apps/controllerx/cx_devices/tuya.py new file mode 100644 index 00000000..35a17368 --- /dev/null +++ b/apps/controllerx/cx_devices/tuya.py @@ -0,0 +1,20 @@ +from cx_const import DefaultActionsMapping, Light +from cx_core import LightController + + +class TS0044LightController(LightController): + def get_z2m_actions_mapping(self) -> DefaultActionsMapping: + return { + "1_single": Light.TOGGLE, + "1_double": Light.CLICK_BRIGHTNESS_UP, + "1_hold": Light.CLICK_BRIGHTNESS_DOWN, + "2_single": Light.TOGGLE, + "2_double": Light.CLICK_BRIGHTNESS_UP, + "2_hold": Light.CLICK_BRIGHTNESS_DOWN, + "3_single": Light.TOGGLE, + "3_double": Light.CLICK_BRIGHTNESS_UP, + "3_hold": Light.CLICK_BRIGHTNESS_DOWN, + "4_single": Light.TOGGLE, + "4_double": Light.CLICK_BRIGHTNESS_UP, + "4_hold": Light.CLICK_BRIGHTNESS_DOWN, + } diff --git a/docs/_data/controllers/TS0044.yml b/docs/_data/controllers/TS0044.yml new file mode 100644 index 00000000..15f9f632 --- /dev/null +++ b/docs/_data/controllers/TS0044.yml @@ -0,0 +1,43 @@ +name: TS0044 (TuYa) +device_support: + - type: Light + domain: light + controller: TS0044LightController + delay: 350 + mapping: + - "Click top left → Toggle" + - "Double click top left → Brighten up (1 step)" + - "Hold top left → Dim down (1 step)" + - "Click top right → Toggle" + - "Double click top right → Brighten up (1 step)" + - "Hold top right → Dim down (1 step)" + - "Click bottom left → Toggle" + - "Double click bottom left → Brighten up (1 step)" + - "Hold bottom left → Dim down (1 step)" + - "Click top right → Toggle" + - "Double click top right → Brighten up (1 step)" + - "Hold top right → Dim down (1 step)" +integrations: + - name: Zigbee2MQTT + codename: z2m + actions: + - 1_single → Click top left + - 1_double → Double click top left + - 1_hold → Hold top left + - 2_single → Click top right + - 2_double → Double click top right + - 2_hold → Hold top right + - 3_single → Click bottom left + - 3_double → Double click bottom left + - 3_hold → Hold bottom left + - 4_single → Click top right + - 4_double → Double click top right + - 4_hold → Hold top right +note: >- + 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 custom mapping. + You can check here for reference. + Also, this controller support hold action, but not release. This means that there is not + smooth brightness changes when holding, just step by step everytime is held. diff --git a/docs/assets/img/TS0044.jpeg b/docs/assets/img/TS0044.jpeg new file mode 100644 index 00000000..f81b2817 Binary files /dev/null and b/docs/assets/img/TS0044.jpeg differ diff --git a/docs/controllers/TS0044.md b/docs/controllers/TS0044.md new file mode 100644 index 00000000..8d910b7d --- /dev/null +++ b/docs/controllers/TS0044.md @@ -0,0 +1,5 @@ +--- +layout: controller +title: TS0044 (TuYa) +device: TS0044 +---