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

Export supported_features of light.isy994 #5429

Closed
wants to merge 1 commit into from

Conversation

andrey-git
Copy link
Contributor

Description:

Related issue (if applicable): fixes #5428

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@@ -72,7 +72,9 @@ def turn_on(self, brightness=None, **kwargs) -> None:
@property
def state_attributes(self):
Copy link
Member

Choose a reason for hiding this comment

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

This should not be overridden in the platforms. It's only for the parent class. The attributes will be collected from existing properties, so just make sure the corresponding properties return correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default brightness is only exposed when the device is on.
I don't have isy994, and don't know why here it is exposed always.

@jbcodemonkey added it in a3db0ec

@jbcodemonkey Is it indeed required here to always expose brightness?

Copy link
Member

Choose a reason for hiding this comment

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

@andrey-git didn't you say that you changed the frontend so that the brightness would show depending on supported features in state attributes? That attribute is always returned from state attributes, even when off.

Copy link
Member

Choose a reason for hiding this comment

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

a3db0ec was not correctly implemented.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Component/BaseEntity use state_attributes and platform use device_state_attributes and can overwrite stuff from state_attributes

Copy link
Member

Choose a reason for hiding this comment

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

ISYDevice shouldn't override state attributes either. It is allowed to overwrite device state attributes. Change that and don't change this light platform. It looks as the properties here already return correctly (Edit: except state attributes) so the attributes will be collected in the state attributes in the light ABC class. Then in the entity class state attributes and device state attributes will be merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I propose someone with isy944 device make the fix then. Even if the current state of events is broken I'm afraid to break it further since I can't really test it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll take a look at this now. Some history on this, the ISY component was written right around the same time that the Entity abstract classes were being cleaned up. That is why somethings are overwritten that probably shouldn't be. In fact, I don't believe that device_state_attributes existed at the time that the ISY component was originally written.

@rmkraus
Copy link
Contributor

rmkraus commented Jan 19, 2017

Thank you @andrey-git for quickly addressing the issue even though you don't have an ISY994. 🍺

Taking the comments from this PR, I have addressed the issue in a different way in PR #5433 and tested to confirm the ISY component still works. I'll go ahead and close this PR so the new one can be reviewed.

@rmkraus rmkraus closed this Jan 19, 2017
@andrey-git andrey-git deleted the patch-2 branch January 23, 2017 20:44
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ISY994 Lights not showing dimmer slide in 0.36.1
5 participants