Tuya Color Issue when using Smart Life or Tuya App

Hello everyone!

I just found a compatibility issue between Tuya lights and HassIO. I have researched in this forum but didn’t find any other person that posted this same issue.

This will be mostly for the developers that works on this project and see if they can fix it.

In fact I found multiple issues:

  1. When I try to select/change the color from an entity has been defined under lights_group:
    a) The color icon does not change (Image attached)
    b) The color that the bulbs turned into was a cool white, not the normal white that I get when using Tuya or Smart Life apps.

Here below it changed correctly to blue: Icon + Bulbs
53

Here below the icon didn’t changed to blue
17

Something that I have also noticed is that, sometimes HassIO returns: “brightness”: “255” or “brightness”: 255 or “brightness”: “100”.
In one hand, the group.py library is failing because an error trying to convert int to string (255 to “255”). I don’t know when it happens but it does. (image attached)

Error when trying to execute line 250

On the other hand, Tuya handles the brightness in % from 1 to 100 instead 0 to 255. So, I guess HassIO should have an option to translate into Tuya values.

I hope it helps to solve the issue.
Thank you a lot!

I have logged what happened in group.py line 250 (_LOGGER.exception(“Value %s fails”, args))

Value (255, '255', '255', '255', '255') fails
9:50 PM /config/custom_components/light/group.py (ERROR)

As you can see the first value does not goes with ’ ’ as a string.

New findings. The lamps that have issues while setting colors on HassIO are the ones with the firmware 1.0.0
The ones that have the firmware 2.3.0 works better.

Do anyone know if a hassio developer can fix this issue? I’m willing to help!
Thanks!

Anyone that can helps on this?

I still getting errors because my lamps does not support the tuya.py is on Hassio.

Thanks!

A friendly reminder about the issue:

Update for light.bedroom fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 223, in         async_update_ha_state
yield from self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 350, in         async_device_update
    yield from self.async_update()
  File "/config/custom_components/light/group.py", line 202, in async_update
    self._brightness = _reduce_attribute(on_states, ATTR_BRIGHTNESS)
  File "/config/custom_components/light/group.py", line 274, in _reduce_attribute
    return reduce(*attrs)
  File "/config/custom_components/light/group.py", line 250, in _mean_int
    return int(sum(args) / len(args))
TypeError: unsupported operand type(s) for +: 'int' and 'str'

Not trying to hijack your thread. I am EXTREMELY new to this and found the documentation on adding tuya devices but i feel I’m not doing enough. Could you point me in the right direction how you got these set up at all? Devices appear in app but show as “unavailable” and are therefore unresponsive.

Hey @Chris_Perry, no worries. I can help. I know why it appears unavailable. It happened to me.
You must set them on lights.yaml.

#lights.yaml
- platform: group
name: Living
entities:
   - light.living_light_1
   - light.living_light_2

This has to fix your issue.
Please let me know.

Thank you sir! I actually ended up having a much dumber problem. I had inadvertently opened two separate smart life / Tuya accounts at one time and directed home assistant to an the wrong account that used to have a device connected to it. Once I realized my error everything worked super smoothly. Many hours were wasted because of this error on my part.

I’m glad you solved it! Welcome to the Tuya world & Hassio. Sadly, hassio is showing some incompatibility with the tuya devices. Too many timeouts and errors while trying to turn on or off lights. But it is also depend on the tuya devices are using.
Can you show me with e link, which tuya bulbs have you bought?

Thanks!
Javier

Sure think! I am currently only running two different tuya devices. I purchased these bulbs.
Smart WiFi Light Bulb, LED RGB… https://www.amazon.com/dp/B07DLSNNDS?ref=yo_pop_ma_swf
If they keep working as they can then I can recommend them highly. I’m not saying they are the best- I have nothing to benchmark them against, but they have been working NEAR flawlessly for me. I am also running these smart plugs (but the don’t appear to be selling them any longer)
Smart Plug 2 Pack TanTan Wi-Fi… https://www.amazon.com/dp/B074FZ5563?ref=yo_pop_ma_swf
My last devices are z-wave and I just got them up and running yesterday. I’m using the aotech z-stock controller and two ge z-wave light switches for my kids’ room. Next thing on the list is trying to configure google home support. The tuya devices work natively but the z-wave stuff will have to be passed along via hassio and it looks kind of involved unless I purchase the cloud account. The only other thing I can think of is thermostats and cameras and then I’m pretty much at a loss on how to make my home “smart”. I guess I’ll have to start building rules and automations.

I’m also not trying to hijack this thread, but thought I could add something worthwhile: I have the smart WiFi bulb as well as the kisslink plugs. They are all working great (as of this writing).

Thank you for your feedback. The bulbs do not work very well or do not support very well some commands are specifics bulbs I bought. Now I got new ones and work like a charm.
Best

I have several Teckin brand bulbs that worked perfectly before, but whatever happened with Tuya’s backend seems to have made them have the same symptoms you all are seeing here. My older, and less advanced bulbs, have no issues with color or control.