Skip to content

Fix FLUX_LED error when no color is set #13527

Merged
balloob merged 4 commits intohome-assistant:devfrom
dramamoose:dev
Mar 30, 2018
Merged

Fix FLUX_LED error when no color is set #13527
balloob merged 4 commits intohome-assistant:devfrom
dramamoose:dev

Conversation

@dramamoose
Copy link
Copy Markdown
Contributor

Description:

As is, an error gets thrown when turn_on is called without an HS value. By adding an if statement, we only try to set RGB if an HS value is applied.

Related issue (if applicable): fixes #13519

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

As is, an error gets thrown when turn_on is called without an HS value. By adding an if statement, we only try to set RGB if an HS value is applied.
Handle turn_on situation when no color is set

hs_color = kwargs.get(ATTR_HS_COLOR)
rgb = color_util.color_hs_to_RGB(*hs_color)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blank line contains whitespace

@dramamoose dramamoose closed this Mar 29, 2018
@dramamoose dramamoose reopened this Mar 29, 2018
@dramamoose dramamoose changed the title Handle turn_on situation when no color is set Fix FLUX_LED error when no color is set Mar 29, 2018
hs_color = kwargs.get(ATTR_HS_COLOR)
rgb = color_util.color_hs_to_RGB(*hs_color)

if hs_color is not None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

`

if hs_color:
...
else:
...

@dramamoose
Copy link
Copy Markdown
Contributor Author

Thanks! Made the changes.

@amelchio amelchio added this to the 0.66 milestone Mar 30, 2018
@balloob balloob merged commit f40efe0 into home-assistant:dev Mar 30, 2018
@balloob
Copy link
Copy Markdown
Member

balloob commented Mar 30, 2018

Thanks! 🐬

balloob pushed a commit that referenced this pull request Mar 30, 2018
* Handle turn_on situation when no color is set

As is, an error gets thrown when turn_on is called without an HS value. By adding an if statement, we only try to set RGB if an HS value is applied.

* Fix Whitespace Issues

* Made Requested Changes
@balloob balloob mentioned this pull request Mar 30, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
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.

Flux Led/MagicLight - Unable to change brightness

7 participants