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

Fix matter light color capabilities bit map #88693

Merged
merged 7 commits into from
Feb 25, 2023

Conversation

ArturoGuerra
Copy link
Contributor

Breaking change

Proposed change

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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
  • The code has been formatted using Black (black --fast 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.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @home-assistant/matter, mind taking a look at this pull request as it has been labeled with an integration (matter) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of matter 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 matter Removes the current integration label and assignees on the pull request, add the integration domain after the command.

Copy link
Member

@marcelveldt marcelveldt left a comment

Choose a reason for hiding this comment

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

First of all: thanks!

See my review comments, try to prevent lookups for values that are static. Just do that once in the entity init or how it is now: check if the "supported_color_modes" attribute is still None and set some local variables which are cheap to access.

As for the custom Enum I'd suggest to remove that and copy the BitFlags for now from the SDK code so we can just use that as soon as we move to a newer sdk version.

I will test with the white ambiance lights but I'm pretty sure this was the missing piece of the puzzle yesterday!

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft February 24, 2023 10:59
@ArturoGuerra ArturoGuerra marked this pull request as ready for review February 24, 2023 23:04
@home-assistant home-assistant bot requested a review from marcelveldt February 24, 2023 23:04
class ColorCapabilities(IntFlag):
"""Color control capabilities bitmap."""

kHueSaturationSupported = 0x1
Copy link
Member

Choose a reason for hiding this comment

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

Do we know what k means?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, the only reason it's there is cuz that's how the code generated on the matter repo has it and we can just remove this entire enum once the library is updated https://github.com/project-chip/connectedhomeip/blob/61cf6f2368a4fc20e96d0ba87bda9a78a6028717/src/controller/python/chip/clusters/Objects.py#L20332-L20345

Copy link
Member

Choose a reason for hiding this comment

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

Ok.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I don't know either why the k is in there but let's stick to the SDK definitions so all good now, thanks @ArturoGuerra

Copy link
Member

@marcelveldt marcelveldt left a comment

Choose a reason for hiding this comment

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

Great, works perfectly fine now with the white ambiance lights

@marcelveldt marcelveldt changed the title Add matter light color capabilities bit map Fix matter light color capabilities bit map Feb 25, 2023
@marcelveldt marcelveldt added this to the 2023.3.0 milestone Feb 25, 2023
@marcelveldt marcelveldt merged commit 0a3a8c4 into home-assistant:dev Feb 25, 2023
@ArturoGuerra
Copy link
Contributor Author

Perfect only thing that is missing now is getting the enhanced hue stuff working but I don't think there are any lights that even support it atm so testing might be a bit challenging 😀

frenck pushed a commit that referenced this pull request Feb 25, 2023
* Adds matter light color capabilities bit map

* Fixed matter light hue and saturation test
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants