Tuya’s smart color bulbs

Tuya’s smart bulbs are one of the cheapest and do not rely on hubs. So it is ideal for a test of smart bulbs before invest a lot. If you go to tuya.com, you see that they do not sell bulbs. Instead, they sell their devices and service to many third-party bushiness. That’s why there are so many cheap brands of smart home devices. Almost all the cheapest devices comes from Tuya. For example, Feit from Costco, Merkury from walmart.

To use the re-branded devices, you could either use Tuya cloud or the app provided by the third party to control your devices. Either way, your device has to be connect to internet via 2.4G WiFi. If you use the Tuya cloud, you might be able to connect to your Home assistant via tuya. If you lose internet connection, you would lose control of you device. Also, your experience of smart devices hugely depends on your quality of Internet service and it might fluctuate.

Feature of the color bulbs

I purchased the Feit color bulb from Costco during promotion. The price for a single color bulb is 5 dollars. The color bulb typically has two modes. One white model that has a tunable color temperature. There are two types of physical LED. One at color temperature of 2700K warm white. Another at color temperature of 6500K day light. The bulb then use Pulse Width Modulation, or Floquet engineering (preferred by physicist) to interpret the temperature in between.

The other mode is RGB color mode. In this mode, the two white LED are tuned off. Blue, Red, and Green LEDs are tuned on. Again, the same technique could be used to adjust the color the the bulb. However, one caveat that is not mentioned is that the luminance of the RGB is way lower than the white mode. They serve as decorative light and I seldomly use this mode.

The bulb cannot connect to 5G WiFi and utilize 2.4G technology only.

Tuyaconvert

If you have an old Tuya device with firmware 3.1, you could flash the firmware via tuyaconvert. You would then have full local control over the device.

Stock firmware

However, nowadays (after 2020), Tuya devices are shipped with newer firmware 3.3 that cannot be overridden. Nevertheless, we could still control the Tuya device through the stock firmware using the link below. Please follow the description in the link.

The idea is the following: You need to register as one of the third-party business that sells tuya devices and develop apps. Next, you run a script that mimic the app that controls the device. Finally, you pair your device with the script and obtain the key and device id of your smart device.

After extracting the above info, you could then use it to control via home assistant. There does not exist a component that controls color rgb yet. So I wrote my own custom component that controls the bulb locally. The script is checked against the Costco Fei bulb. Other brands might work but some might need tweaks of some DPS parameters. You might need to connect to the bulb and use pytuya to debug and determine these parameters by yourself. Since I now have full local control over the smart light bulbs, I placed the devices in a separate subnet and block both the access to local network and Internet from the devices.

Custom component for Home Assistant

Right now, this is still a work in progress.

To do List:

  • the custom component is not async. The device responds to each command instantly, you cannot place the next command until half a second later.
  • There is a feature called custom scene. There are four different scenes. E.g., one corresponds to looping between up to about 6 colors. This could correspond to a feature in home assistant. One could also implement a service directly send a command to the bulb for easier debug.
  • Add Circadian support. Please see github for my current code.

tuyaapi Color rgb light reference pytuya

Note

I did not find any working RGB local tuya implementations Oct 2020. After this blog, I noticed a fork of localtuya that might also be able to control the RGB light after proper setting of parameters