[RELEASE] of Tuya local Generic Window Blind driver

I see a few people are looking for local (i.e. no cloud) solutions for tuya, and I have gotten a few requests around Window Blind driver. I do not own a tuya window blind myself hance developing a driver has been challenging. But thanks to @vitaliy_kh 's request and later testing the current driver should work for Graywind Motorized Vertical Blinds. As @vitaliy_kh has pointed out in this tread Custom Driver Abnormal Behavior it still has some bugs I haven't been able to figure out as, already pointed out, I do not have the hardware to test on. But if someone else find it useful, here you go:

3 Likes

I confirm the driver works great for my wifi window blind. Thank you so much for your work.
Any chance you can make one for color light bulb?

Update:
Homebridge doesn't see any device under Window Shades selection. It does when I use Tuya IoT Platform (Cloud) driver though. If I add the shade under "Others" (only field that see my shades), Homekit shows device not supported.

It would be interesting to give it a go. Do you have the "status" message from the bulb? (see step 12 and 6 in the Quick Summary? I need some information on the endpoints.

I suspect that a capability "WindowShade" needs to be added to my driver for it to be able to be picked up by all Apps/functions. It seems like those two capabilities are somewhat overlapping, and no clear definition on when to use one or the other. Given the required functions is seems that WindowShade is a sub-set of the Window Blind, so they can co-exist in the same driver.

The drivers works well by controling endpoint 20 (on off)

Here is a decrypted message from your log.

Decryted message: {"devId":"85481764ecfabca2d71e","dps":{"20":true,"21":"white","22":1000,"23":267,"24":"000003e803e8","25":"000e0d00002e03e8000000c80000","26":0}}

With an On / Off / Status request to the endpoint - (Debug Log ) showing exchanges

2023-01-27 10:02:03.017 error org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: user_driver_iholand_tuya_Generic_Device_618.socketStatus() is applicable for argument types: (java.lang.String) values: [send error: Connection reset] (method socketStatus)
dev:1222023-01-27 10:02:02.078 debug Sending message to 192.168.1.163:6668 msg: 000055AA000000000000000700000087332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9F8EA5A0CD662138845F5C3A0FA2663C77FC68440F7911AF8305C5AF622D9BEE218AFCE8EDB79438540D30C3D52D4D852FDAF73B9F0000AA55
dev:1222023-01-27 10:02:02.076 debug HEX crc: daf73b9f : 4
dev:1222023-01-27 10:02:02.075 debug 151
dev:1222023-01-27 10:02:01.991 debug Prefix: 000055AA00000000000000
dev:1222023-01-27 10:02:01.989 debug 135
dev:1222023-01-27 10:02:01.987 debug 332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9F8EA5A0CD662138845F5C3A0FA2663C77FC68440F7911AF8305C5AF622D9BEE218AFCE8EDB79438540D30C3D52D4D852F000000000000AA55
dev:1222023-01-27 10:02:01.984 debug payload after={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831721","dps":{"20":true}}
dev:1222023-01-27 10:02:01.975 debug 9c52c7babb6200b40992c4143356eeba568e328d7392f12f6d07bb38b5bbccf308c58452115df50ea8a4b50c5fa365216bdf5a69c1a608abae623334ab691b9f8ea5a0cd662138845f5c3a0fa2663c77fc68440f7911af8305c5af622d9bee218afce8edb79438540d30c3d52d4d852f
dev:1222023-01-27 10:02:01.972 debug payload before={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831721","dps":{"20":true}}
dev:1222023-01-27 10:02:01.970 debug 33
dev:1222023-01-27 10:01:55.061 error org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: user_driver_iholand_tuya_Generic_Device_618.socketStatus() is applicable for argument types: (java.lang.String) values: [send error: Connection reset] (method socketStatus)
dev:1222023-01-27 10:01:54.797 debug Sending message to 192.168.1.163:6668 msg: 000055AA000000000000000700000087332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9F795A2AB65A261DD2FEA9594D85B669FFFC68440F7911AF8305C5AF622D9BEE218AFCE8EDB79438540D30C3D52D4D852F35373B1E0000AA55
dev:1222023-01-27 10:01:54.795 debug HEX crc: 35373b1e : 4
dev:1222023-01-27 10:01:54.794 debug 151
dev:1222023-01-27 10:01:54.702 debug Prefix: 000055AA00000000000000
dev:1222023-01-27 10:01:54.700 debug 135
dev:1222023-01-27 10:01:54.697 debug 332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9F795A2AB65A261DD2FEA9594D85B669FFFC68440F7911AF8305C5AF622D9BEE218AFCE8EDB79438540D30C3D52D4D852F000000000000AA55
dev:1222023-01-27 10:01:54.695 debug payload after={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831714","dps":{"20":true}}
dev:1222023-01-27 10:01:54.686 debug 9c52c7babb6200b40992c4143356eeba568e328d7392f12f6d07bb38b5bbccf308c58452115df50ea8a4b50c5fa365216bdf5a69c1a608abae623334ab691b9f795a2ab65a261dd2fea9594d85b669fffc68440f7911af8305c5af622d9bee218afce8edb79438540d30c3d52d4d852f
dev:1222023-01-27 10:01:54.683 debug payload before={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831714","dps":{"20":true}}
dev:1222023-01-27 10:01:54.682 debug 33
dev:1222023-01-27 10:01:04.014 debug Decryted message: {"devId":"85481764bcddc2a16f60","dps":{"20":false,"21":"colour","22":1000,"23":446,"24":"000003e803e8","25":"000e0d00002e03e8000000c80000","26":0}}
dev:1222023-01-27 10:01:04.011 debug *********** Decrypting **************
dev:1222023-01-27 10:01:04.007 debug Assembled payload for decrypt: 9C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF3DF43C2664D80DAE00071EDADDB43BB0D4DFA40460FD85B1742C99A3D29B76032F1B61B58B3161E5701A73EC33971AFE9609486BE564DC728E0F10E28F8C1A667AC1EC7F0CB6D0F96BBDA45E2DC78F570E23F65BDE4EA4633080921304A45CEDD0A186C3A9B94D92ECA34EF5B419A4ED9149D595D9DDD8ED32F35481CF0433C3B
dev:1222023-01-27 10:01:03.999 debug End of message: 160
dev:1222023-01-27 10:01:03.990 debug Bytes incoming: 188
dev:1222023-01-27 10:01:03.989 debug Encrypted message detected
dev:1222023-01-27 10:01:03.986 debug Raw incoming data: �RǺ�b� ��3V�V�2�s��/ma�8�����C�fM���q��C�
M�@F�[Bɚ=)�`2�eX�W�>�9q��`���VM�(��(���g����m���E��x�p�?e���F3 !0JE��
l:���.�4�[A�N��Y]�ݎ�/5H�C<;�6%R�U
dev:1222023-01-27 10:01:03.969 debug 000055AA000000000000000A000000AC000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF3DF43C2664D80DAE00071EDADDB43BB0D4DFA40460FD85B1742C99A3D29B76032F1B61B58B3161E5701A73EC33971AFE9609486BE564DC728E0F10E28F8C1A667AC1EC7F0CB6D0F96BBDA45E2DC78F570E23F65BDE4EA4633080921304A45CEDD0A186C3A9B94D92ECA34EF5B419A4ED9149D595D9DDD8ED32F35481CF0433C3BF43625520000AA55
dev:1222023-01-27 10:01:03.967 debug Receiving message from device
dev:1222023-01-27 10:01:03.417 debug Sending message to 192.168.1.163:6668 msg: 000055AA000000000000000A000000789C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF38129A14B23D7607EA22A35EC1D5B40A8073989828579969FC9BEE36498A7929FF24BF6BCF7007677707D64BD69D2169BFA627A172665A3B3348339592330640CB6C444B6F75FE6E85CCAFCD07DE8B1CE1FA2A6650000AA55
dev:1222023-01-27 10:01:03.415 debug HEX crc: 1fa2a665 : 4
dev:1222023-01-27 10:01:03.414 debug 136
dev:1222023-01-27 10:01:03.298 debug Prefix: 000055AA00000000000000
dev:1222023-01-27 10:01:03.296 debug 120
dev:1222023-01-27 10:01:03.294 debug 9C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF38129A14B23D7607EA22A35EC1D5B40A8073989828579969FC9BEE36498A7929FF24BF6BCF7007677707D64BD69D2169BFA627A172665A3B3348339592330640CB6C444B6F75FE6E85CCAFCD07DE8B1CE000000000000AA55
dev:1222023-01-27 10:01:03.291 debug payload after={"devId":"85481764bcddc2a16f60","gwId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831663"}
dev:1222023-01-27 10:01:03.282 debug 9c52c7babb6200b40992c4143356eeba568e328d7392f12f6d07bb38b5bbccf38129a14b23d7607ea22a35ec1d5b40a8073989828579969fc9bee36498a7929ff24bf6bcf7007677707d64bd69d2169bfa627a172665a3b3348339592330640cb6c444b6f75fe6e85ccafcd07de8b1ce
dev:1222023-01-27 10:01:03.279 debug payload before={"devId":"85481764bcddc2a16f60","gwId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831663"}
dev:1222023-01-27 10:01:03.277 debug 33
dev:1222023-01-27 10:00:58.798 debug Decryted message: {"devId":"85481764bcddc2a16f60","dps":{"20":false},"t":1674831656}
dev:1222023-01-27 10:00:58.796 debug *********** Decrypting **************
dev:1222023-01-27 10:00:58.794 debug Assembled payload for decrypt: 9C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF3DF43C2664D80DAE00071EDADDB43BB0DCB0CF439E6EBAB6A12AD72A9B62AB2DD13ED83F25D26DBBC9EEEDA703857AD2C
dev:1222023-01-27 10:00:58.789 debug End of message: 80
dev:1222023-01-27 10:00:58.784 debug Bytes incoming: 151
dev:1222023-01-27 10:00:58.783 debug Encrypted message detected
dev:1222023-01-27 10:00:58.781 debug Raw incoming data: x�p��UU�k3.3�RǺ�b� ��3V�V�2�s��/ma�8�����C�fM���q��C�
��9��j�r��*����]&ۼ���p8W�,�V��U
dev:1222023-01-27 10:00:58.769 debug 000055AA00000000000000070000000C00000000789370910000AA55000055AA00000000000000080000006B00000000332E33000000000000000E000000019C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF3DF43C2664D80DAE00071EDADDB43BB0DCB0CF439E6EBAB6A12AD72A9B62AB2DD13ED83F25D26DBBC9EEEDA703857AD2CC65691130000AA55
dev:1222023-01-27 10:00:58.768 debug Receiving message from device
dev:1222023-01-27 10:00:58.229 debug Sending message to 192.168.1.163:6668 msg: 000055AA000000000000000700000087332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9FA434601365987544C49E2BE5551AC632D8E2BDA7A75880B2BF6661EFF1E84406C8B6EDCBBE1E8C73F650138CC9CC0FE82149F6C30000AA55
dev:1222023-01-27 10:00:58.227 debug HEX crc: 2149f6c3 : 4
dev:1222023-01-27 10:00:58.226 debug 151
dev:1222023-01-27 10:00:58.093 debug Prefix: 000055AA00000000000000
dev:1222023-01-27 10:00:58.091 debug 135
dev:1222023-01-27 10:00:58.088 debug 332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9FA434601365987544C49E2BE5551AC632D8E2BDA7A75880B2BF6661EFF1E84406C8B6EDCBBE1E8C73F650138CC9CC0FE8000000000000AA55
dev:1222023-01-27 10:00:58.085 debug payload after={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831658","dps":{"20":false}}
dev:1222023-01-27 10:00:58.076 debug 9c52c7babb6200b40992c4143356eeba568e328d7392f12f6d07bb38b5bbccf308c58452115df50ea8a4b50c5fa365216bdf5a69c1a608abae623334ab691b9fa434601365987544c49e2be5551ac632d8e2bda7a75880b2bf6661eff1e84406c8b6edcbbe1e8c73f650138cc9cc0fe8
dev:1222023-01-27 10:00:58.071 debug payload before={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831658","dps":{"20":false}}
dev:1222023-01-27 10:00:58.070 debug 33
dev:1222023-01-27 10:00:51.530 debug Decryted message: {"devId":"85481764bcddc2a16f60","dps":{"20":true},"t":1674831648}
dev:1222023-01-27 10:00:51.527 debug *********** Decrypting **************
dev:1222023-01-27 10:00:51.525 debug Assembled payload for decrypt: 9C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF3B39592EC20FBFFF379C46E214C7654A1A8A0F1A55D6424D8CE0A63B0ED596EA9C8B6EDCBBE1E8C73F650138CC9CC0FE8
dev:1222023-01-27 10:00:51.519 debug End of message: 80
dev:1222023-01-27 10:00:51.514 debug Bytes incoming: 151
dev:1222023-01-27 10:00:51.512 debug Encrypted message detected
dev:1222023-01-27 10:00:51.510 debug Raw incoming data: x�p��UU�k3.3
�RǺ�b� ��3V�V�2�s��/ma�8���󳕒� ���y�n!LvT����]d$��
c��Yn�ȶ�˾�s�P����d�B��U
dev:1222023-01-27 10:00:51.498 debug 000055AA00000000000000070000000C00000000789370910000AA55000055AA00000000000000080000006B00000000332E33000000000000000D000000019C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF3B39592EC20FBFFF379C46E214C7654A1A8A0F1A55D6424D8CE0A63B0ED596EA9C8B6EDCBBE1E8C73F650138CC9CC0FE864D442E40000AA55
dev:1222023-01-27 10:00:51.496 debug Receiving message from device
dev:1222023-01-27 10:00:50.896 debug Sending message to 192.168.1.163:6668 msg: 000055AA000000000000000700000087332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9F55F08D00EF9C7DD7A9A5624D6BDA4C8EFC68440F7911AF8305C5AF622D9BEE218AFCE8EDB79438540D30C3D52D4D852F4B13905A0000AA55
dev:1222023-01-27 10:00:50.893 debug HEX crc: 4b13905a : 4
dev:1222023-01-27 10:00:50.891 debug 151
dev:1222023-01-27 10:00:50.761 debug Prefix: 000055AA00000000000000
dev:1222023-01-27 10:00:50.758 debug 135
dev:1222023-01-27 10:00:50.751 debug 332E330000000000000000000000009C52C7BABB6200B40992C4143356EEBA568E328D7392F12F6D07BB38B5BBCCF308C58452115DF50EA8A4B50C5FA365216BDF5A69C1A608ABAE623334AB691B9F55F08D00EF9C7DD7A9A5624D6BDA4C8EFC68440F7911AF8305C5AF622D9BEE218AFCE8EDB79438540D30C3D52D4D852F000000000000AA55
dev:1222023-01-27 10:00:50.748 debug payload after={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831650","dps":{"20":true}}
dev:1222023-01-27 10:00:50.738 debug 9c52c7babb6200b40992c4143356eeba568e328d7392f12f6d07bb38b5bbccf308c58452115df50ea8a4b50c5fa365216bdf5a69c1a608abae623334ab691b9f55f08d00ef9c7dd7a9a5624d6bda4c8efc68440f7911af8305c5af622d9bee218afce8edb79438540d30c3d52d4d852f
dev:1222023-01-27 10:00:50.735 debug payload before={"devId":"85481764bcddc2a16f60","uid":"85481764bcddc2a16f60","t":"1674831650","dps":{"20":true}}
dev:1222023-01-27 10:00:50.732 debug 33

Hmm, I found this page that describes the protocol Generic Light Bulb Template-Tuya IoT Development Platform-Tuya Developer there is some complexity there that is not trivial to solve. However it should be solvable, but preferably with an actual bulb to play with. Perhaps someone on this forum that has a tuya color bulb want to give it a try?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.