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

ISY994 Lights not showing dimmer slide in 0.36.1 #5428

Closed
jbcodemonkey opened this issue Jan 18, 2017 · 10 comments · Fixed by #5433
Closed

ISY994 Lights not showing dimmer slide in 0.36.1 #5428

jbcodemonkey opened this issue Jan 18, 2017 · 10 comments · Fixed by #5433

Comments

@jbcodemonkey
Copy link
Contributor

jbcodemonkey commented Jan 18, 2017

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
0.36.1

Python release (python3 --version):
3.5.2+

Component/platform:
ISY

Description of problem:
ISY imported Lights do not show brightness slider below journal chart. Instead a dropdown labelled 'Effect' is in its place.
image

Expected:
Rolling back to 0.35.3 restored functionality.
image

Problem-relevant configuration.yaml entries and steps to reproduce:

Traceback (if applicable):

Additional info:

@jbcodemonkey
Copy link
Contributor Author

@Teagan42 @rmkraus @fabaff @randellhodges @OverloadUT

Any of you try the latest release and observe the same?

@andrey-git
Copy link
Contributor

@jbcodemonkey could you go to /dev-state and paste here all the attributes of this device?

Is this light/isy994.py ?

@andrey-git
Copy link
Contributor

A change I have done for light UI in 36.x was to show the brightness slider if the device supports it via supported_features attribute and not if brightness attribute exists.
(This still doesn't explain the appearance of "Effects" header)

@jbcodemonkey
Copy link
Contributor Author

Yes, light/isy994.py

Attributes for light.1dr_floods:
brightness: 127
friendly_name: Dining Room Floods
icon: mdi:spotlight-beam

@jbcodemonkey
Copy link
Contributor Author

In light/isy994.py, there is:

@property
def supported_features(self):
    """Flag supported features."""
    return SUPPORT_BRIGHTNESS

@andrey-git
Copy link
Contributor

Found the bug:
isy994 indeed declares supported_features but it overrides state_attributes without exporting it:

@property
def state_attributes(self):
    """Flag supported attributes."""
    return {ATTR_BRIGHTNESS: self.value}

in light/__init__.py 👍

    @property
    def state_attributes(self):
        """Return optional state attributes."""
        data = {}

        if self.is_on:
            for prop, attr in PROP_TO_ATTR.items():
                value = getattr(self, prop)
                if value is not None:
                    data[attr] = value

            if ATTR_RGB_COLOR not in data and ATTR_XY_COLOR in data and \
               ATTR_BRIGHTNESS in data:
                data[ATTR_RGB_COLOR] = color_util.color_xy_brightness_to_RGB(
                    data[ATTR_XY_COLOR][0], data[ATTR_XY_COLOR][1],
                    data[ATTR_BRIGHTNESS])
        else:
            data[ATTR_SUPPORTED_FEATURES] = self.supported_features

        return data

@andrey-git
Copy link
Contributor

Created a Fix PR

@andrey-git
Copy link
Contributor

@jbcodemonkey Your feedback is required on the fix PR

rmkraus added a commit that referenced this issue Jan 19, 2017
The ISY component included an ISYDevice base class that is used by all
of the isy994 platforms. This still overwrote the state_attributes
property instead of the more appropriate device_state_attributes
property. This was also repeated in the isy994 light platform. Both of
these were addressed. This also fixes issue #5428.
@rmkraus
Copy link
Contributor

rmkraus commented Jan 19, 2017

Hijacked @andrey-git's PR like a pirate. ☠️

@jbcodemonkey
Copy link
Contributor Author

jbcodemonkey commented Jan 19, 2017

Tested with commit from 5433, works again. Thank you!!

balloob pushed a commit that referenced this issue Jan 20, 2017
* Updated ISY component to not overwrite state_attributes.

The ISY component included an ISYDevice base class that is used by all
of the isy994 platforms. This still overwrote the state_attributes
property instead of the more appropriate device_state_attributes
property. This was also repeated in the isy994 light platform. Both of
these were addressed. This also fixes issue #5428.

* Removed custom state attributes from ISY lights.

The brightness attribute need not be manually reported by the isy994
light platform.

* Removed ISY Node cleanup.

The ISY entities don’t really need to unsubscribe themselves while hass
is shutting down. Because these updates are not sent in a thread, there
is no negative impact from shutting down without unsubscribing. This
greatly speeds up hass shutdown.

* Removed unused attribute from isy994 light platform.

* Cleaned up ISY994 light entity class.

1) Removed the state property. This property is set in the Entity base
class and shouldn’t be overridden here.
2) Set the brightness property. This is the proper way of setting the
brightness for the Light base class.
3) Removed properties that are now unused because of these changes.
@home-assistant home-assistant locked and limited conversation to collaborators Apr 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants