home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.03k stars 28.28k forks source link

2024.4 Tuya integration: lights white/color mode not updated #115056

Open bartplessers opened 1 month ago

bartplessers commented 1 month ago

The problem

Hi, Since HA 2024.4.0 I noticed that HA does not show the color mode correctly of my Tuya bulbs.

So

This makes that all my Tuya bulbs become more or less useless in HA:

Anybody same problem? Any solution?

Kind regards, Bart Plessers

What version of Home Assistant Core has the issue?

core-2024.4.1

What was the last working version of Home Assistant Core?

core-2024.3.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

bartplessers commented 1 month ago

extra info: after some investigation, I noticed that this problem only occurs with Tuya lights that only support [white + color] I have some other Tuya bulbs that support [white with colortemp + color], here the above problem does not occur...

Kelso-Utah commented 1 month ago

White + Color only. My lights in this picture are set to White (CCT in Tuya App). Any time I change brightness or an automation occurs, such as dimming to nn%, they change to a color. Sucks that HASS does not support setting them back to White (CCT). 01da2a820373cf4a8f79fb52557d7571d3731e9b_2_253x500

bartplessers commented 1 month ago

set to White (CCT in Tuya App)

Are you sure this light has the capability to change color temperature? Or does it have only white + color? In my experience:

Seems that HA is not aware anymore of the white capabilities of the bulb if it does not support colortemp (CCT)

bartplessers commented 1 month ago

Hi everyone,

I installed a previous version of HA (2023.3.1) on my proxmox server. Here this problem does not occur.

On following screenshot: 2024-04-09_11-02-51

What I did:

Version 2024.3.1: shows the correct state of the bulb Version 2024.4.2: state of bulb is NOT updated and remains blue

Kelso-Utah commented 1 month ago

set to White (CCT in Tuya App)

Are you sure this light has the capability to change color temperature? Or does it have only white + color? In my experience:

  • lights with (white + CCT, and RGB) do not have any problem
  • lights with (white and RGB) experience the above problem

Seems that HA is not aware anymore of the white capabilities of the bulb if it does not support colortemp (CCT)

To me, white is the CCT setting in the Tuya app. Others may think of it as a bit of a yellow/white. I don't care for the color version of white... seems like it has too much blue.

Regardless, Home Assistant stopped reading the status of these lights, and I have had to disable all automation with my lights and create routines in my Alexa.

I did find out these lights can be set back to CCT by saying, "Alexa, set the lights to WHITE." 4cb17760a50ebfc599552758f4a8308a350c7a7f_2_253x500

Kelso-Utah commented 1 month ago

01da2a820373cf4a8f79fb52557d7571d3731e9b_2_253x500

Just noticed this in Developer Tools image

Kelso-Utah commented 1 month ago

@bartplessers I have reached out to 2 of the authors that made changes to the Tuya light component. I'm waiting to hear back from either of them.

bartplessers commented 1 month ago

In example, following screenshots from my Tuya app

TYPE 1

This bulb supports white with CCT and color: white with CCT + color

You can see that you can select a warm white on the left side of the arc, and a cool white (more blue) on the right side of the arc. The light still remains in “white modus”, but you can modify the correlated color temperature (CCT) Beside this, you can also choose the “color modus” (on the top, select “kleur”). In that case, you can choose any RGB color that you want

TYPE 2

This bulb only supports white and color: white + color

You can see that there is no difference in color temperature in the arc. The white modus supports only one temperature of white. Beside this, you can also choose the “color modus” (on the top, select “kleur”).

The problem we are dealing with does only occur on bulbs of type 2. As far as I can see on your screenshot, is that in your “CCT” modus, there is no possibility to change the color temp. It seems that you can only activate one colortemp. So it looks like it’s also a “type 2” bulb.

bartplessers commented 1 month ago

FYI @Kelso-Utah I downgraded to HA 2024.3.3 This version has no problems with this kind of Tuya lights

bartplessers commented 1 month ago

Here is some other interesting thing: I have 2 concurrent instances of HA running on my ProxMox server. Both have the Tuya integration running

What you can see here: same light, but other version of HA:

HA 2024.3.3

2024-04-10_21-54-57

HA 2024.4.2

2024-04-10_21-54-27

So it seems that HA 2024.4.x does not recognize the "brightness" modus of this tuya bulb!

Kelso-Utah commented 1 month ago

Hey there @tuya @zlinoliver @frenck I don't know why this thread isn't getting any attention but I'm sure there are more than 2 people that use these type of Tuya lights. Also, the code changes for Tuya Component relating to color mode were not in the release notes for 2024.4.

karprzy commented 1 month ago

I got same problem.

bartplessers commented 1 month ago

Created a new issue on https://github.com/tuya/tuya-home-assistant/issues/987

spacelama commented 1 month ago

Yup, I started suffering from this recently, "supported_modes" comes back only with "hs", whereas a few weeks ago it was coming back with "brightness" as well. Except even then I couldn't actually change to "brightness" from turn_on - once HA set the light to "hs", it was stuck in "hs". Now it's stuck in "hs" every single time I make any sort of change from HA.

I am suspicious of 770e48d5.

spacelama commented 1 month ago

With 770e48d, it looks like WORK_MODE must be "white" to get brightness. How do I work out what device.category is of my particular devices?

EDIT: looks like category == "dj" from device info > device diagnostics.

And I can see data.status.work_mode = "white" whenever the tuya app was the last set to white, and HA hasn't come along and fiddled with the settings yet. Alas, as soon as HA fiddles with the brightness (not just power - power toggle leaves the settings as they were), data.status.work_mode reverts to "colour" (I praise the developers for their proper spelling of "colour").

I can't find a way of getting work_mode back into "white". Also, the GUI can't do it, which tells me it's not my fault.

bartplessers commented 4 weeks ago

device info > device diagnostics Same light, same integration, different versions oh HA:

2023.3.3

tuya-2023.3.3.json

2024.4.3

tuya-2024.4.3.json

bartplessers commented 4 weeks ago

@spacelama With https://github.com/home-assistant/core/commit/770e48d51265d9c613cadd066d7f53d9b0e2498d,

To me it seems that following logic is missing in latest version 2024-04-18_21-00-15

bartplessers commented 3 weeks ago

hi @emontnemery, @kamaradclimber, @lellky , @Orhideous , @MartinHjelmare

Do you mind taking a look at this issue? I have a feeling that this problem was introduced with https://github.com/home-assistant/core/pull/110327 resulting in https://github.com/home-assistant/core/commit/770e48d51265d9c613cadd066d7f53d9b0e2498d

lellky commented 3 weeks ago

Hi!

Sorry, but I don't think I can help. I review the linked PR, but I have no understanding of the inner workings here.

/Lellky

bartplessers commented 3 weeks ago

FYI. Problem still exist in 2024.4.4

bartplessers commented 3 weeks ago

hi @homeassistant , is there any way to add the label "integration: tuya" to this issue? On other issues, I see 2024-04-24_10-35-37

Maybe the bot is not triggered because initialy I forgot to mention the integration in the OP...?

ph30n1x commented 2 weeks ago

Experiencing this issue and it's only for lights that have white +RGB (no white temperature). Since upgrading to 2024.4, five of my lights only show HS colour mode and randomly go to the RGB lights when triggered by HA. The tuya app can change them back to white but goes back to RGB due to HA (even when the automation is only to turn on with no other settings)

bartplessers commented 2 weeks ago

same problem on 2024.5.0

Please can somebody give this some attention. I'm also using zigbee2mqtt. There is a new release https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.37.0 but ... this release requires at least Home Assistant 2024.4.

I really want to upgrade, but this tuya issue prevents me from doing this :-(

Kelso-Utah commented 2 weeks ago

Bart,

I know this isn't the fix you may be looking for but recently, I came across something in a release notes section that Smart Life was replacing the Tuya Integration (or something similar to that).

I have since installed the SmartLife integration, the app for my phone, and reset ALL of my lights to operate using the Smart Life app and integration. Granted, I still do not have the option to change my lights from Color to CCT in Home Assistant, but I am able to change the brightness in Home Assistant without the lights switching to color.

Hope this helps, 

Kelso

bartplessers commented 2 weeks ago

Hi @Kelso-Utah ,

What do you exactly mean with Smartlife integration? On my phone, I can use the Smartlife app and use this instead of the tuya app. But on homeassistant, I can't find any smartlife integration.

So I'm a bit confused...

Kelso-Utah commented 2 weeks ago

Hi @Kelso-Utah ,

What do you exactly mean with Smartlife integration?

View this page: https://github.com/tuya/tuya-smart-life

The instructions are there. It involves copying the repository, unzipping the files to a directory, then copy the folder to the Home Assistant configuration directory.

After that, adding the integration is easy. You will have to uninstall the "Tuya" integration. Screenshot_20240502_115701_Home Assistant Screenshot_20240502_120019_Home Assistant

Hope this helps

bartplessers commented 2 weeks ago

Hi @Kelso-Utah ,

thanx for pointing me in the good direction! I managed to set things up in my test evironment...

The Good

The Bad

The Ugly

So it was good testing this, but it can't be the final solution. However, maybe it can give some more background information to the developers that are willing to debug this issue.

Thanx again, kind regards, bart plessers

bartplessers commented 2 weeks ago

2024.5.1 Problem still exists.

I need some Xanax

jacobgrillo commented 1 week ago

the issue must be fixable, it's only become and issue recently.

bartplessers commented 1 week ago

I have a feeling that may be the cause Simplify color mode logic in Tuya light (https://github.com/home-assistant/core/pull/110327) resulted in https://github.com/home-assistant/core/commit/770e48d51265d9c613cadd066d7f53d9b0e2498d and introduced in 2024.4.0b0

I think this is missing now: 323729519-428aff4c-2694-4af7-bdf5-d68fe072e229

However, I'm not a developer, otherwise I would revert this change and see what happens...

Zak707 commented 1 week ago

I too experience this since starting HA server right at version 2024.4 so I therefore never saw the White mode in those. In fact, it caused me some grief trying to figuring out what I was doing wrong until some search indicated the issue to be a newly introduced bug.

In Tuya, there is a specific tab for me to set White mode and brightness while the other allow color selection. The bulb switch automatically that way. If I use tuya to open white 80%, all is fine and I can switch to any color/level or use scene. In Tuya I can do any color and brighness but cannot activate while mode, when trying the bulb light up yellow 100% (which is way dimmer than white mode).

If I set the bulb in white in Tuya than only use Toggle/On/Off in HA it will allow to switch. But changing any parameter in HA cause the bulb to go into color mode instead without being able to return to white mode from within HA trigger. It just seem that White mode is not exposed to HA.

Zak

Chevan94 commented 1 week ago

Given the fact that all of my Tuya bulbs are affected by this, this is extremely annoying. Had to downgrade to core 2024.3.1 to make this all work.

Would it be possible to fix this by some other way? Create a custom script or whatever that takes care of the Tuya bulbs?

I'm currently using 12 Gosund WB4 bulbs soooooooo yeah.

Has anyone had any luck setting up local Tuya with these?

bartplessers commented 1 week ago

2024.5.3. Still same problem

spacelama commented 1 week ago

@bartplessers , since no one's actively working on the problem, updating this issue at every single release isn't going to achieve anything other than contribute noise to the issues database. I did briefly look at reverting the commit we brought into question, but reverting that and likewise going back to the previous version of the code didn't fix the problem for me, but I'm not yet confident that I was correctly running the code in my testing container.

bartplessers commented 6 days ago

but I'm not yet confident that I was correctly running the code in my testing container.

can you investigate this further?

I'm not a developer, but not afraid of VSCode and git. Is there a good newbie tutorial how to revert that piece of code and run it in a sandbox?

Grtz Bartplessers