11.9 C
New York
Sunday, November 24, 2024

Glen Akins Pythonizes a Set of XMCOSY RGBW Patio Lights for Automated Per-Mild Management



Glen Akins has redecorated his backyard with low-cost off-the-shelf RGB LED patio lights — cleverly reverse-engineered and upgraded for compatibility with WLED and, optionally, TinyTuya.

“Two years in the past, I hung a set of generic G50 RGB globe lights within the yard. They weren’t precisely waterproof and the person lights turned waterlogged and began performing erratically,” Akins writes by means of background to the mission. “This yr, I changed them with two units of XMCOSY+ RGBW Patio String Lights. The brand new XMCOSY lights look nice and I like that there is actual white LEDs in them to allow them to present each ornament and useful illumination for my yard.”

The lights are designed to be managed from the Tuya Sensible Life smartphone app, being based mostly on a Tuya microcontroller board. “I believe the app is enough for most individuals’s wants,” Akins says. “I intend to make use of the Sensible Life app more often than not with these lights however was fascinated by with the ability to management them from crontab and a Python script.”

Whereas Tuya supplies an software programming interface (API) for this, Akins determined to assault the issue a special means: reverse-engineering the management alerts, discovering — with a fast have a look at the oscilloscope traces — that the lights used the WS2811 protocol at 800kHz with 5V signalling.

With that data in hand, Akins was capable of management the lights from an Athom Tech WLED controller — offering help for Christian Schwinne’s fashionable lighting management system on an Espressif ESP32 microcontroller, with Athom’s explicit board including infrared and radio-frequency distant compatibility.

Then, Akins switched to one thing he hadn’t tried earlier than: the TinyTuya Python library, which may use Tuya’s official Web of Issues (IoT) cloud service to generate the keys required to challenge instructions fully domestically. “The fundamentals labored effectively sufficient,” Akins writes of the library, “however what I actually needed to do was set the colours of all of the bulbs individually.

By sniffing the visitors between the official cellphone app and the lights, Akins was ready to determine a method to format the messages for per-light management. “Every colour is specified with a tuple containing the six parameters [required],” Akins writes of the ensuing Python script. “The colours will likely be repeated if there’s extra lights on the string than colours specified within the dictionary.”

This is not Akins’ first shot at determining how one can get extra flexibility from off-the-shelf RGB LED lighting: in November final yr he printed a submit documenting experimentation with “a couple of units of random LED lights from third-party sellers on Amazon,” all of which resulted in at the very least partial WLED compatibility.

Akins’ full write-up is on the market on his weblog, together with the supply code for the per-light Python management script.

Related Articles

Latest Articles