Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ColorMode.WHITE when Tuya bulbs support white but don't have temp_value #126242

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

wedsa5
Copy link

@wedsa5 wedsa5 commented Sep 19, 2024

Tuya: Add ColorMode.WHITE when bulb supports white but doesn't have temp_value

Breaking change

N/A

Proposed change

Tuya bulbs that support a white color mode but don't have adjustable white color temp were broken several versions of HA ago. See this large thread.

I added a check after the check for color temp to check if the bulb supports work_mode white. If the bulb does not support color_temp, but it still supports white work_mode, I will add ColorMode.WHITE to the list of supported color_modes. I also added a new entity value _white_color_mode which will hold the color mode corresponding to how the bulb supports white. It will either be WHITE or COLOR_TEMP.

Modified the turn_on function to check for ATTR_WHITE as well as ATTR_COLOR_TEMP in determining if the command should include setting the work_mode to WHITE. If the _white_color_mode is COLOR_TEMP, it will also set the color temp in the commands.

Modified the color_mode function to return the _white_color_mode when the work_mode is white. Again, this can be either WHITE or COLOR_TEMP.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

home-assistant[bot]

This comment was marked as outdated.

@home-assistant
Copy link

Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this pull request 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 pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign tuya Removes the current integration label and assignees on the pull request, 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 pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wedsa5

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@wedsa5
Copy link
Author

wedsa5 commented Sep 19, 2024

This is very much a draft and needs more testing with other bulbs. I have tried to avoid any breaking changes though. I will clean up the logging and comments later.

home-assistant[bot]

This comment was marked as outdated.

@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch from ba38808 to 3179b95 Compare September 19, 2024 04:12
home-assistant[bot]

This comment was marked as outdated.

@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch from 6f30e16 to 5170faf Compare September 19, 2024 04:25
@MartinHjelmare MartinHjelmare changed the title Tuya: Add ColorMode.WHITE when bulb supports white but doesn't have temp_value Add ColorMode.WHITE when Tuya bulbs support white but don't have temp_value Sep 19, 2024
@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch 3 times, most recently from 62d0f15 to 8f5f868 Compare September 19, 2024 22:12
@wedsa5 wedsa5 marked this pull request as ready for review September 19, 2024 22:12
@wedsa5 wedsa5 requested a review from frenck as a code owner September 19, 2024 22:12
@wedsa5
Copy link
Author

wedsa5 commented Sep 19, 2024

Functional testing has been completed by myself and @bartplessers.

@wedsa5
Copy link
Author

wedsa5 commented Sep 19, 2024

@MartinHjelmare @frenck , I cannot add the bugfix label to the PR (or I don't know how). Can you please add it so that the required-labels check passes?

@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch 2 times, most recently from dac0e63 to a39b25b Compare September 24, 2024 17:35
@wedsa5 wedsa5 marked this pull request as draft September 24, 2024 17:37
@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch 2 times, most recently from 7cfc2c9 to 3c9533c Compare September 24, 2024 17:43
@wedsa5 wedsa5 marked this pull request as ready for review September 24, 2024 17:44
@wedsa5
Copy link
Author

wedsa5 commented Sep 24, 2024

@MartinHjelmare @frenck, the @homeassistant bot is still marked as requesting changes related to the cla signature which i've fixed. I tried "Re-request review", but it didn't seem to do anything. Please advise! Thanks.

@frenck
Copy link
Member

frenck commented Sep 24, 2024

@MartinHjelmare @frenck, the @homeassistant bot is still marked as requesting changes related to the cla signature which i've fixed. I tried "Re-request review", but it didn't seem to do anything. Please advise! Thanks.

It doesn't...

CleanShot 2024-09-24 at 23 19 49@2x

@wedsa5
Copy link
Author

wedsa5 commented Sep 25, 2024

It doesn't...

@frenck
I thought there was an issue due to this:
image
This is my first PR, so not really sure if everything is in order or not.

@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch 2 times, most recently from f6c6af2 to e010117 Compare September 30, 2024 17:11
@klier

This comment was marked as off-topic.

@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch from e010117 to f558750 Compare October 2, 2024 15:56
@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch from beb3be8 to 8c9a376 Compare October 9, 2024 18:40
@jbusuttil83
Copy link

jbusuttil83 commented Oct 13, 2024

I will give this a review as well but we need an approval from a maintainer.
Can anyone give me an outline on how to test this locally?

@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch 2 times, most recently from bd153ec to bdf5097 Compare October 21, 2024 15:03
@jbusuttil83
Copy link

Can you guide on on how I would test this on my local installation?

@wedsa5
Copy link
Author

wedsa5 commented Oct 21, 2024

Can you guide on on how I would test this on my local installation?

See the bottom of my comment
And this comment

@jkrall
Copy link
Contributor

jkrall commented Nov 4, 2024

What is required to get this merged? I'm willing to help... but it seems like it might have just gotten stalled. Is it just waiting on a review from @frenck?

@frenck
Copy link
Member

frenck commented Nov 4, 2024

What is required to get this merged? I'm willing to help... but it seems like it might have just gotten stalled. Is it just waiting on a review from @frenck?

Patience. Thanks 👍

@wedsa5 wedsa5 force-pushed the tuya-light-white-color-mode-fix branch from bdf5097 to 28480ae Compare November 4, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2024.4 Tuya integration: lights white/color mode not updated
6 participants