jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
868 stars 157 forks source link

add example for a string of XmCosy+ RGBW patio string lights #445

Closed bikerglen closed 5 months ago

bikerglen commented 5 months ago

I have some XMCosy+ RGBW patio string lights that permit the colors of each bulb to be set individually and independently of each other. This example takes a list of colors and assigns them to the bulbs in the string sequentially. The code encodes the list of colors into a string that can be sent to the bulbs using the set_value function with an index of 102. I've tested this with both a set of 15 patio string lights and a string of 6 flood lights. Both use Tuya controllers and are manufactured by the Shenzhen Bling Lighting Technology Company Limited. Index 102 is likely the mechanism used by the "DIY" mode's preview button in the Smart Life app.

jasonacox commented 5 months ago

Nice stand-alone example for the Tuya device Contrib repo. Thanks for the addition, @bikerglen ! 🙏

bikerglen commented 5 months ago

No problem. I just noticed I hard coded the number of colors in the chase to 6 in the for loop at the very end of main. I need to replace the 6 with a len(colors) and the 5-i with len(colors)-1-i on lines 110 and 111. I'll try to get a fix in tomorrow night after work.