Skip to content

Migrate limitlessled light to color_mode#69430

Merged
frenck merged 1 commit intodevfrom
limitlessled_light_color_mode
May 13, 2022
Merged

Migrate limitlessled light to color_mode#69430
frenck merged 1 commit intodevfrom
limitlessled_light_color_mode

Conversation

@emontnemery
Copy link
Copy Markdown
Contributor

Proposed change

Migrate limitlessled light to color_mode

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

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.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

return self._fixed_color_mode

# The light supports both hs and white with adjustable color temperature
if self._effect == EFFECT_NIGHT or self._color is None or self._color[1] == 0:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is copying the condition from the hs_color attribute, which was previously gated by checking if the saturation was 0. @smwa can you help confirm that's the correct way to determine the current mode of the light (color or white with adjustable color temperature)?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Affirmative, this should be sufficient

return self._fixed_color_mode

# The light supports both hs and white with adjustable color temperature
if self._effect == EFFECT_NIGHT or self._color is None or self._color[1] == 0:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Affirmative, this should be sufficient

COLOR_MODES_LIMITLESS_DIMMER = {COLOR_MODE_BRIGHTNESS}
SUPPORT_LIMITLESSLED_DIMMER = SUPPORT_TRANSITION
COLOR_MODES_LIMITLESS_RGB = {COLOR_MODE_HS}
SUPPORT_LIMITLESSLED_RGB = SUPPORT_EFFECT | SUPPORT_FLASH | SUPPORT_TRANSITION
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Several of these will no longer have SUPPORT_BRIGHTNESS. Is that assumed from SUPPORT_TRANSITION, or does this assume that all bulb types have brightness?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The SUPPORT_BRIGHTNESS flag is deprecated, brightness support is instead implied the color modes: https://developers.home-assistant.io/docs/core/entity/light#color-modes.

This comment was marked as outdated.

@emontnemery emontnemery force-pushed the limitlessled_light_color_mode branch from 9483c03 to dfaba85 Compare May 13, 2022 08:20
@emontnemery emontnemery marked this pull request as ready for review May 13, 2022 08:21
@emontnemery
Copy link
Copy Markdown
Contributor Author

Set to "ready for review", thanks @smwa for the feedback 👍

@frenck frenck merged commit 3adaad7 into dev May 13, 2022
@frenck frenck deleted the limitlessled_light_color_mode branch May 13, 2022 09:40
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2022
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.

5 participants