Sudden Problems With Tuya Smart Life Lights

Sorry not familar with docker setups. I run ha in a venv on plain ubuntu, I just knwo that when i left ha running and edited the file it didnt work. had to shut it down.

maybe someone else knows how to access it that way.

You need to connect to your Home Assistant docker directly. The SSH addon doesn’t give you full access. If you are running through Raspbian (not HassOS) you first have to ssh into your Rasspbian then run
sudo docker exec -it homeassistant /bin/bash
this should get you a full Shell inside the Home Assistant docker container. Now you should be able to navigate to
/usr/local/lib/python3.7/site-packages/tuyaha/devices/
to find light.py and replace it with a patched version.

FYI you will have to do this each time you do a home assistant update

Hello, I got this reply from tuya about the color issue…

Hello, that's because color_mode is based on work_mode ["white", "colour",] to get the value. The string of code I provided to you above is to get the color:
{
  "header": {
    "name": "colorSet",
    "namespace": "control",
    "payloadVersion": 1
  },
  "payload": {
    "color": {
      "hue": 0,
      "saturation": 0,
      "brightness": 1
    },
    "accessToken": "token",
    "devId": "devId"
  }
}

Does it help to understand the issue?

I applied the fixes suggested here, but HA is not able to read the original status of the light and its color (it only stores the new color when changed from HA, but it’s not able to read it if changed from somewhere else…)

I gave up on the tuya app 2 nights ago and tested flashing 1 bulb with tuya-convert and it went smoothly. I had to make a custome template:
{“NAME”:“Zemismart_RGBW”,“GPIO”:[0,0,0,0,40,41,0,0,38,39,37,0,0],“FLAG”:0,“BASE”:18}
and this got the colours/brightness etc working in HA using mqtt
I then converted another 3 last night and used the same/AILight template on those (they are identical bulbs ordered at the same time so not sure why 1 needed a different template) and theye are all working now too.
I was sceptical of doing this but it’s been great and responses are quicker and as I boost I no longer rely on their cloud service so I’d reccommend this route to regain control of the bulbs :slight_smile:
Alexa control using haaska still works for them too.
I will be doing the last 4 of them today then dumping the smartlife app.

I did’nt have color support for my Tuya bulb since december.
I try your solution with your light.py link and lbradcrc light.py to. Both did’nt give to me de color, brightness only.
Also, i have this error to,

Unable to prepare setup for platform tuya.switch: Platform not found (cannot import name ‘SwitchEntity’ from ‘homeassistant.components.switch’ (/usr/src/homeassistant/homeassistant/components/switch/init.py)).

switch.py is there frome HA file.
Some one can help me on this?

For those still facing this issue, I discovered the other day that you can use the new Configuration > Customizations to override supported_features and show the color settings anyways. No patching needed. What worked for me was setting supported_features to 19 (e.g., 1+2+16) but that number might change depending on what features your light supports. Now I have full control back over my color bulbs!

# Bitfield of features supported by the light entity
ATTR_SUPPORTED_FEATURES = 'supported_features'
SUPPORT_BRIGHTNESS = 1
SUPPORT_COLOR_TEMP = 2
SUPPORT_EFFECT = 4
SUPPORT_FLASH = 8
SUPPORT_RGB_COLOR = 16
SUPPORT_TRANSITION = 32
SUPPORT_XY_COLOR = 64
SUPPORT_WHITE_VALUE = 128
8 Likes

thanks for this. worked perfectly for me.

Just had two RGB Lohas bulbs arrive today, and they were only acting as white bulbs in HA. This fixed them, cheers!

The fix i used

HA doesn’t appear to be able to poll the bulb for the current colour setting, but this has at least given me the option to change them. Brilliant find!

New problem started today: the Tuya Smart Life component can no longer set the color of my color bulb correctly. Working fine yesterday, today the named colors are all wrong, looking almost like one of the RGB LEDs has failed - but it hasn’t, the Smart Life app can still set the proper colors.

2 Likes

Exact same situation here. Was working 24 hours ago. Thinking it might be a problem with the 0.111.4 update that just came out. Experiencing problems with a _OS version on a Pi 4 and a _container version on another Pi 4. Initially, thought I broke something on my _container installation because I was messing with some color selection code in AppDaemon but noticed the same symptoms on my _OS installation. Alexa and Smart Life app can set the bulb colors correctly.

Edit: My customizations.yaml has the bulbs’ supported features overridden to 19 (RGB, color temp, and brightness) which had been working fine.
Edit2: So maybe this isn’t a 0.111.4 issue because my _OS installation is still running on 0.110.5.

Tuya is getting quite exasperating. This is the 2nd time they have broken HA in the last 6 months (their support response is reported to be “what is Home Assistant?”). And just this month they dropped IFTTT support because they didn’t want to pay IFTTT a fee. Their position is that nobody should need anything other than their app, because there’s no need to interact with non-Tuya devices.

I just put in a quick patch for the moment. I already had to make a Node Red function earlier this month to change my bulb color, replacing the color bulb setting function in IFTTT with a webhook call to Node Red. I added another node after that to fire an Alexa routine to change the bulb color, and I had to add an Alexa routine for each separate color that I use since there’s no way to pass a color parameter to an Alexa routine.

Integration ha_tuya_custom on HACS

Appears to fix the recent problems - github page has instructions to follow.

1 Like

Hi there, just wanted to ask , what about the effects? Changing supported_features value worked for me also, now color wheel appeared and it works, but also appeared effects selector, which is empty.

Ive tried every code for support features. And the Effects selector still empty

I know this is kind of an old topic, but I was able to resolve this issue.
As we all know TUYA is REALLY bad. I am actually new to AH and spent ALL DAY yesterday AND the day before, trying to figure this out. I was literally about to flash my bulbs, because even the TUYAHA fix didn’t work.
2 unbranded bulbs of the same brand, 2 different light strips, all working beautifully.
HERE’S WHAT I DID:

Disabled TUYA from HA
Opened TUYA
IMPORTANT!!! --> CHANGE THE MODE TO COLOR. Make sure you can see the color wheel.
Choose a Color
Re-add TUYA (STOCK) in HA

Should have the Color Picker now. - Enjoy!

This solution worked straight away.
Tried all the others and nothing worked…

1 Like

This solution worked straight away.
Tried all the others and nothing worked…

Which solution? Nor tuya_custom nor the one above your post fixed RGB color for me.

Apologies if this has been covered already
Just moved home so have to reconfigure halal over again
I have bought some led WiFi colour changing lights for the front of my house in a gu10 connector
8 in total

One fails to retain its connection in tuya even though it’s closer than others
The other 7 do work in the tuya app

Linking tuya to ha and ha only shows 4 smart lights

Is this the same sort of issue being discussed here

Thanks for viewing

Paul