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
73.89k stars 30.96k forks source link

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

Open bartplessers opened 7 months ago

bartplessers commented 7 months 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 7 months 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...

bartplessers commented 7 months 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 7 months 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

bartplessers commented 7 months 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 7 months ago

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

bartplessers commented 7 months 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!

karprzy commented 7 months ago

I got same problem.

bartplessers commented 7 months ago

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

spacelama commented 7 months 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 7 months 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 7 months 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 7 months 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 7 months 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 7 months 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 7 months ago

FYI. Problem still exist in 2024.4.4

bartplessers commented 7 months 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 6 months 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 6 months 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 :-(

bartplessers commented 6 months 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...

bartplessers commented 6 months 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 6 months ago

2024.5.1 Problem still exists.

I need some Xanax

jacobgrillo commented 6 months ago

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

bartplessers commented 6 months 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 6 months 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 6 months 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 6 months ago

2024.5.3. Still same problem

spacelama commented 6 months 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 months 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

ph30n1x commented 6 months ago

Has the Tuya integration been put into purgatory after being put into Core? @frenck why isn't anyone looking at this problem?

ph30n1x commented 6 months ago

anyone who has interacted with this issue thread, can you please add comments to https://github.com/home-assistant/core/issues/116326

bartplessers commented 5 months ago

Is there any way to set this on the roadmap? It' really annoying to be stuck on version 2024.3.3 and not able to upgrade without braking my whole smarthome... :-(

Francois-du-Plessis commented 5 months ago

Adding my voice aswell. Also running into this issue which makes having the Tuya bulbs in my HA basically useless.

home-assistant[bot] commented 5 months ago

Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tuya` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tuya` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

joostlek commented 5 months ago

I don't know if it's being worked on, but that issue was about a custom component, thus it should not belong here.

bartplessers commented 5 months ago

@joostlek Where does it belong?

According to @spacelama https://github.com/tuya/tuya-home-assistant/issues/987 it doesn't belong to Tuya integration either.

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

but from @emontnemery, @kamaradclimber, @lellky , @Orhideous , @MartinHjelmare (whom approved the above code) not much reaction

so where does it belong...??

In my opinion, the bug itself doesn't belong in homeassistant.

joostlek commented 5 months ago

This issue belongs here as long as it's an issue with the Tuya integration. Please don't ping random people in your comment.

ph30n1x commented 5 months ago

Ok I believe I have found the root cause of the issue (quite annoyed that the developers haven't looked into this). In commit #110327 Line 508 the function filter_supported_color_modes is introduced / used for the first time. That specific function removes ColorMode.BRIGHTNESS from the list provided to it. By removing ColorMode.BRIGHTNESS it breaks the functionality for Tuya lights that have separate colour and CCT LEDs within the same light.

spacelama commented 5 months ago

@Kelso-Utah - do be less entitled about what you expect from other people doing this for free, please.

Feel free to request your money back though.

ph30n1x commented 5 months ago

Ok on an initial test HA returned the following error, so it appears there is some group forcing changes to removing color modes that some device require, for example our RGB+CCT lights. Its is affecting multiple integrations (for example Wiz) and I think that is why the developers are ignoring these bug reports. I am now close to ditching Home Assistant if these kinds of short sighted changes are being made to fundamental integrations. Where is the documentation stating these changes and their reasoning??

Logger: homeassistant.components.light Source: components/light/init.py:1162 integration: Light (documentation, issues) First occurred: 1:38:57 PM (20 occurrences) Last logged: 1:38:57 PM

None (<class 'custom_components.tuya.light.TuyaLightEntity'>) sets invalid supported color modes {<ColorMode.BRIGHTNESS: 'brightness'>, <ColorMode.HS: 'hs'>}, this will stop working in Home Assistant Core 2025.3, please report it to the author of the 'tuya' custom integration None (<class 'custom_components.tuya.light.TuyaLightEntity'>) sets invalid supported color modes {<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.BRIGHTNESS: 'brightness'>, <ColorMode.HS: 'hs'>}, this will stop working in Home Assistant Core 2025.3, please report it to the author of the 'tuya' custom integration None (<class 'custom_components.tuya.light.TuyaLightEntity'>) sets invalid supported color modes {<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.BRIGHTNESS: 'brightness'>}, this will stop working in Home Assistant Core 2025.3, please report it to the author of the 'tuya' custom integration

emontnemery commented 5 months ago

@bartplessers you mention the lights you have problem with support color + white with non-adjustable color temperature. This case is not correctly handled by the tuya integration, and I'll try to fix that if I can get some help with debug logs which show the state updates from Tuya lights.

logger:
  default: info
  logs:
    homeassistant.components.tuya: debug
    tuya_sharing: debug

Please also share a diagnostic dump: image

emontnemery commented 5 months ago

@ph30n1x You mention you see the problem with lights which support RGB+CCT. Can you confirm your light actually allow changing the color temperature when in white mode?

bartplessers commented 5 months ago

Hi @emontnemery

and I'll try to fix that

Cool!

you mention the lights you have problem with support color + white with non-adjustable color temperature

correct.

Attached, you can find the home-assistant.log and the diagnostic dump

In the Tuya app on my phone, I:

Hope you have enough information now.

kind regards, Bartplessers

home-assistant.log config_entry-tuya-40b4813a92b0c0230ab7e16905d5861b.json

ph30n1x commented 5 months ago

Hi Erik, the lights in question are white only with RGB like Bart. Was getting the terminology mixed up.

On Mon, Jun 17, 2024 at 4:55 PM Erik Montnemery @.***> wrote:

@ph30n1x https://github.com/ph30n1x You mention you see the problem with lights which support RGB+CCT. Can you confirm your light actually allow changing the color temperature when in white mode?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/115056#issuecomment-2172730760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2ZBX46XFOWT7EN5P2OK6DZH2QAZAVCNFSM6AAAAABF2XUNYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZSG4ZTANZWGA . You are receiving this because you were mentioned.Message ID: @.***>

-- Blake Weston

zpatten commented 5 months ago

Happening to me too; was going nuts thinking I was doing something wrong until I stumbled across this.

zpatten commented 5 months ago

BTW; please let me know if I can help in any way to fix this; I would be happy to contribute towards getting this resolved.

deepakkamesh commented 4 months ago

+1 I have the same issue. Happy to help with logs if needed.

On Tue, 25 Jun 2024 at 18:48, Zachary (Zara) Patten < @.***> wrote:

BTW; please let me know if I can help in any way to fix this; I would be happy to contribute towards getting this resolved.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/115056#issuecomment-2190377952, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD57RLLPEFCK3NLYV2GX4DTZJIMYFAVCNFSM6AAAAABF2XUNYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJQGM3TOOJVGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ph30n1x commented 4 months ago

@emontnemery Do you have any updates on this issue?

bartplessers commented 4 months ago

2024.7.0 Every single update I'm hoping for improvement but nothing... Stuck on 2024.3.3 for more than 3 months now. I love home assistant, I love this community, but this is starting to get very annoying.

Is there anything that I can do to accelerate this process?

dbius commented 4 months ago

2024.7.0 Every single update I'm hoping for improvement but nothing... Stuck on 2024.3.3 for more than 3 months now. I love home assistant, I love this community, but this is starting to get very annoying.

Is there anything that I can do to accelerate this process?

You may give it a try to tuya-local. I have a Gosund smart bedside lamp which affected using tuya integration, but with tuya-local (NOT local tuya!) works again as it should be (identified as an rgbw lightbulb).

edmund-1 commented 4 months ago

I have the issue too. Not able to revert Tuya lights from color mode to white mode. Kind of annoying to use each time Smart Life for this. https://github.com/home-assistant/core/issues/115056#issuecomment-2210382661 @dbius, right now I am using local-tuya for some power meters and tuya integration for the rest of tuya devices (door sensors, light bulbs RGBW, dehumidifier, air purifier, AC, etc), including their automations/helpers, etc.. Need to make some time to test Tuya-loca to see if I can use only one instead of two, and I need to do this asap, as my trust in Tuya integration drops below 0 (see: https://github.com/home-assistant/core/issues/120644 - Tuya reauthentication problem, where nobody from Tuya/HA told us anything for almost one week, and same, nothing after the fix). Longh term, I am planning to get rid of this cheap not reliable and unpredictable Chinese bullshit and stop buying western products that rely on this technology, ex: Beko, Hama, Philips. My time is too expensive to try to workaround what they broke and won't fix.