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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hue Group features based on the bulbs in it #31897

Merged
merged 3 commits into from Feb 17, 2020

Conversation

@guimaraes13
Copy link
Contributor

guimaraes13 commented Feb 17, 2020

Computes the features of a hue group as the union of the features of the bulbs in the group.

Home assistant threats groups of bulbs create on the hue app as if all the bulbs in it had all possible features (brightness, color temperature and color, etc...), even if the group is only composed by simpler bulbs.

Breaking change

May break scripts that relay on information of bulb groups that might no longer exist. For instance, information about color of a group that does not have any bulb that supports color. This informations must be removed from the script.

Proposed change

Change the way the feature of a group is computed, by calculating the feature of a group as the union of the features of the bulbs in the group. As such, a group composed by bulbs that only have brightness and color temperature control (as the hue ambiance bulbs) will only display these options in the user interface. Simplifying the interface by remove unsupported features.

This change is specially important for the homekit integration. In the Home App, a group of bulbs containing only hue ambiance bulbs would had shown the color option as well, since the ambiance bulbs have no color option, it would ignore the color changes made through the Home App, making it not possible to change even the color temperature of the light (a feature that the hue ambiance bulbs do support).

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

This might be related to issue #31784.

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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum
鈥he bulbs in the group
@guimaraes13 guimaraes13 requested a review from balloob as a code owner Feb 17, 2020
@homeassistant

This comment has been minimized.

Copy link
Contributor

homeassistant commented Feb 17, 2020

Hi @guimaraes13,

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!

@probot-home-assistant

This comment has been minimized.

Copy link

probot-home-assistant bot commented Feb 17, 2020

Hey there @balloob, mind taking a look at this pull request as its been labeled with a integration (hue) you are listed as a codeowner for? Thanks!

@homeassistant homeassistant added cla-signed and removed cla-needed labels Feb 17, 2020
@codecov

This comment has been minimized.

Copy link

codecov bot commented Feb 17, 2020

Codecov Report

Merging #31897 into dev will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev   #31897   +/-   ##
=======================================
  Coverage   94.68%   94.68%           
=======================================
  Files         763      763           
  Lines       55181    55181           
=======================================
+ Hits        52249    52250    +1     
+ Misses       2932     2931    -1     
Impacted Files Coverage 螖
homeassistant/components/device_tracker/legacy.py 99.14% <0.00%> (酶) 猬嗭笍
homeassistant/components/uk_transport/sensor.py 94.20% <0.00%> (+0.72%) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 2ce7561...87c5e77. Read the comment docs.

bridge,
is_group,
light,
supported_features=SUPPORT_HUE_EXTENDED,

This comment has been minimized.

Copy link
@balloob

balloob Feb 17, 2020

Member

We should not have a default here. Let that be decided by the code that creates the class.

@@ -170,7 +171,19 @@ def async_update_items(bridge, api, current, async_add_entities, create_item):
if item_id in current:
continue

current[item_id] = create_item(api[item_id])
if isinstance(api, Groups):
supported_features = 0

This comment has been minimized.

Copy link
@balloob

balloob Feb 17, 2020

Member

This code should be part of create_item

supported_features |= SUPPORT_HUE.get(light.type, SUPPORT_HUE_EXTENDED)
supported_features = supported_features or SUPPORT_HUE_EXTENDED
else:
supported_features = SUPPORT_HUE.get(

This comment has been minimized.

Copy link
@balloob

balloob Feb 17, 2020

Member

Same. Part of light create_item

@balloob

This comment has been minimized.

Copy link
Member

balloob commented Feb 17, 2020

Thanks, that's a great contribution !

Please make sure to add a test to verify that the change works.

@guimaraes13

This comment has been minimized.

Copy link
Contributor Author

guimaraes13 commented Feb 17, 2020

Hello @balloob, thank you for the comments. I made the changes and added the test case.

Copy link
Member

balloob left a comment

Amazing. Great contribution !

Dev automation moved this from Needs review to Reviewer approved Feb 17, 2020
@balloob balloob merged commit 93a844b into home-assistant:dev Feb 17, 2020
10 checks passed
10 checks passed
CI Build #20200217.39 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing 2ce7561...87c5e77
Details
codecov/project 94.68% (target 90.00%)
Details
Dev automation moved this from Reviewer approved to Done Feb 17, 2020
@lock lock bot locked and limited conversation to collaborators Feb 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can鈥檛 perform that action at this time.