From 9f9412acab39e887e2ee5b0121479f1c00a7ee23 Mon Sep 17 00:00:00 2001 From: francoisauclair911 Date: Sat, 1 Jan 2022 13:48:33 -0500 Subject: [PATCH] Adds TS0044F Tuya device (#385) * Adds TS0044F Tuya device Little different than the TS0044 Tuya device already implemented * style(black): format code with black Co-authored-by: Xavi Moreno --- RELEASE_NOTES.md | 5 +---- apps/controllerx/cx_devices/tuya.py | 10 ++++++++++ docs/_data/controllers/TS0044F.yml | 28 ++++++++++++++++++++++++++++ docs/assets/img/TS0044F.jpeg | Bin 0 -> 7565 bytes docs/controllers/TS0044F.md | 5 +++++ 5 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 docs/_data/controllers/TS0044F.yml create mode 100644 docs/assets/img/TS0044F.jpeg create mode 100644 docs/controllers/TS0044F.md diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 46097fd5..10b637f1 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -26,9 +26,6 @@ PRERELEASE_NOTE ## :wrench: Refactor --> - +- [TS0044F](https://xaviml.github.io/controllerx/controllers/TS0044F) - add Z2M support diff --git a/apps/controllerx/cx_devices/tuya.py b/apps/controllerx/cx_devices/tuya.py index 35a17368..525262d7 100644 --- a/apps/controllerx/cx_devices/tuya.py +++ b/apps/controllerx/cx_devices/tuya.py @@ -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, + } diff --git a/docs/_data/controllers/TS0044F.yml b/docs/_data/controllers/TS0044F.yml new file mode 100644 index 00000000..6eaa9418 --- /dev/null +++ b/docs/_data/controllers/TS0044F.yml @@ -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 custom mapping. + You can check here 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. diff --git a/docs/assets/img/TS0044F.jpeg b/docs/assets/img/TS0044F.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..f81b28177cab98ac2450deb710b56810ef0b70ae GIT binary patch literal 7565 zcmb_gc|4Tgzdz4Bvl#o>ipVYuWhdFUjGgRM#u$v<*itH$lqFhaS5hKNg-9w%NtBXQ zQYlHaSrRI_XHegM-+TYK_w~BR>v_)me9mWo&gaZI=AX_F0A4E#iUmLr01m-FF#j4P znr~tF17K?l6afHi0Eh4a6e0xv0Yn7g7BB!-$cjJM36Wpo!2qz20kBIvp0Ec%M*0o_ zhQoh)%n8gNj;s^tKbXZl{|V?g1cpb4M+JsQNT{z?0XilWTP#Z>YztU+0rK{Ur9aCA z7qKIW#O#kVCOhWe@QhJRO*cC@*;`O-%ol><8K6c)gkX392n~y7I;}U6aQE<(AiRZf z5y3Km2mDl8RD`jEgAGgP?|wo5pVzluR^$LYQfBG;L;l|ZK0kUC4d%@ovitf)(Ly0^ z1^~O87Qu`L0B;8A(s9udEF1{2024Y0aRLhmEaHPK?7N6d7I>VUOd(GL{5+ggDl-58 z?p8>bh@}NUJ=||0RtfWCgaN=K0I>lrkm?7qGsH@vq2Vl?2(dimkAV0r#5%rz=?wS_ zQ>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F%L*SOx2QGMg@=s) z^pP1Pzce_%QaI;xPGVbdc>n5?o0Yba-&S9!)Be27p-5?^`!{+dljz=X8EnW?+MkA& zx5s@w+!b5lBjmmDP2N{nP=Ro%4s-pgY+ER(23Sz^zY5CYe<-NJPwoRs4SBcJM__~x zSP`z6`yF9}Xu@4hOZ)&V06_BmdbHxX{uo~(Ys7M3E`$8eTEFi?qDQ25Zup~;#F!HR zkn^>_*Nf{_nuF2T5jwLaK?k{-S^UzPBf=h+whhQ6vPPg(%j1WrTW8j`IvTk6CS0Sd zlmb2&!OcV`d@5{VGkM(dug&B?HngS9o_T!f9zgn^%G2@c_b~I%9r!zkpgaZ##eWY*J3X0H`v%E{zX@;DX zmk#YYaZkogaHii!b$qVp%O!*JMSE@J>+TSlb?J(I*>$+$BA;P>&cjEn)3&okbfq7V zjrSY6E`Kk0>PnU9do2UUPdkUYAldgwvvy^I_>CSi4dY&nTSZb10j-#h4EM@M zNA57-;yn+R>xJ?01d)5t%nvI^B2ZtmwzhxIX=f@Pehnof2q*q)gKA&ql zSc#Y1e4(@^Zda~HysBzij`p5j>Eu$SpR`w!F(^Ck~6CU0i>}ak_%i7ZA=v(on=|ZmbT?4If z?of{(?YoamRqjlVGEDkbU^98#KI4_A+l+ZQ(rcxcb-FdNKQ7zTn{oTFrIWysru6iB z&h%>0uVZJr(qx%~kGhpTQc_Y|BUMNA*N$(IrrpfCTz0xmsG_y?mam-Lx|9t4(+`ia zKT>bhrlRPenpd?wL1dUQf>)LHi3@VTZ3oCX~((wCzNT?Kr(u6c>u zqTi2b&aj`T+qSn(41O~utj-Rd_QKK^KCe~cdE33?maQGn=Dw!3$(mkYEo`Kf$cpJ- IZT{JR0mG#^nE(I) literal 0 HcmV?d00001 diff --git a/docs/controllers/TS0044F.md b/docs/controllers/TS0044F.md new file mode 100644 index 00000000..8f202541 --- /dev/null +++ b/docs/controllers/TS0044F.md @@ -0,0 +1,5 @@ +--- +layout: controller +title: TS0044F (TuYa) +device: TS0044F +---