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

Allow independent control of white level on flux_led component #13985

Merged
merged 5 commits into from
May 1, 2018

Conversation

oblogic7
Copy link
Contributor

@oblogic7 oblogic7 commented Apr 18, 2018

Description:

Allows independent control of white level on flux_led lights in RGBW mode. Also preserve brightness on color change.

Checklist:

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

@homeassistant
Copy link
Contributor

Hi @oblogic7,

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!

elif effect == EFFECT_RANDOM:
self._bulb.setRgb(random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255))

#effect selection

Choose a reason for hiding this comment

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

block comment should start with '# '

if rgb is not None:
self._bulb.setRgb(*tuple(rgb), brightness=self.brightness)

#brightness change only

Choose a reason for hiding this comment

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

block comment should start with '# '

@@ -12,9 +12,9 @@

from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PROTOCOL
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_EFFECT, EFFECT_COLORLOOP,
ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_EFFECT, ATTR_WHITE_VALUE, EFFECT_COLORLOOP,

Choose a reason for hiding this comment

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

line too long (84 > 79 characters)

@oblogic7 oblogic7 changed the title Flux led white level Allow independent control of white level on flux_led component Apr 18, 2018
@syssi
Copy link
Member

syssi commented Apr 19, 2018

Please check the travis builds for lint errors, too:

C:195, 0: Unnecessary parens after 'if' keyword (superfluous-parens)
C:196, 0: Unnecessary parens after 'return' keyword (superfluous-parens)

./homeassistant/components/light/flux_led.py:192:1: D202 No blank lines allowed after function docstring

@property
def white_value(self):
"""Return the white value of this light between 0..255."""
return self._bulb.getRgbw()[3]
Copy link
Member

Choose a reason for hiding this comment

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

Currently, the light entity will request the white_value even if not SUPPORT_WHITE_VALUE. Will this raise an error ?

Copy link
Contributor Author

@oblogic7 oblogic7 May 1, 2018

Choose a reason for hiding this comment

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

Retrieving index 3 should not directly result in an error because the flux_led library will always return something on that index even if None. So it would depend on how the code calling white_level handles the values. I can add a sanity check if None or non integer values are not supported.

Copy link
Member

Choose a reason for hiding this comment

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

If it's None, then it's fine as that is the expected return value for "no value"

@balloob balloob merged commit c2d00be into home-assistant:dev May 1, 2018
@balloob balloob mentioned this pull request May 11, 2018
@tadly
Copy link
Contributor

tadly commented May 12, 2018

Seeing as this is the most recent change to the flux component, I'm kind of certain it's what broke it for me.

As it stands all I'm able to do is turn the device on/off and change the brightness of the rgb part. I can't control the w portion at all now.
Setting colors, color temp, kelvin etc. is all broken.

Log isn't throwing any obvious errors.
I might do more investigation tomorrow as it's quite late right now.

@oblogic7
Copy link
Contributor Author

The change on this PR separated the W channel on RGBW to the white level slider instead of controlling W via the brightness slider. This makes sense because RGB brightness should be controllable independently of W brightness.

After looking at this for just a few minutes, I see that the flux.switch component uses xy_color and brightness to control color temperature, so I expect that the flux.switch component is expecting the W channel to respond to brightness level. Don't have time to dig any further tonight, but I think that adding support to flux.switch for RGBW mode would possibly make this work as expected. I will hopefully have time to look into it more tomorrow.

@kineticscreen
Copy link

kineticscreen commented May 14, 2018

Also since the latest update, it's broken scenes for me with the flux_LED component. Specifically if I send both RGB and Brightness settings, it changes the RGB but ignores the brightness change. This is true for both RGB and RGBW units. If I send the brightness change on its own it works fine, but coupled with colour change it ignores the brightness.

So:

    light.TV_Backlight:
        state: on
        rgb_color: [255, 100, 230]
        brightness_pct: 50

....alters the colours only.

    light.TV_Backlight:
        state: on
        brightness_pct: 50

.... changes the brightness.

The YeeLights in this same scene operate as normal, so it does appear to be a specific problem with the lux_LED component. And it ocurrs whether using brightness or brightness_pct

This problem is also present when directly doing this via the Services tab in Hassio.

@oblogic7 oblogic7 deleted the flux_led_white_level branch May 15, 2018 18:11
@oblogic7 oblogic7 mentioned this pull request May 15, 2018
2 tasks
@oblogic7
Copy link
Contributor Author

I've opened a new PR that should correct the issues that were introduced. If either of you can confirm the fixes it would be great.

#14476

@kineticscreen
Copy link

Total noob, so have no idea how to install this sorry. Thanks for getting onto it so quickly.

@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants