-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Minor style changes, cleanup #13654
Minor style changes, cleanup #13654
Conversation
* Change 'self._entity.id' to 'self.entity_id' * Use const 'STATE_OFF' * Added CATEGORY constants * Removed *args from accessory types * Changed 'self._hass' to 'self.hass'
@@ -65,10 +65,10 @@ def _set_services(self): | |||
|
|||
def run(self): | |||
"""Method called by accessory after driver is started.""" | |||
state = self._hass.states.get(self._entity_id) | |||
state = self.hass.states.get(self.entity_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe pass hass
and entity_id
into the HomeAccesory
constructor, then you can remove those assignments from all child classes & you dont need the no-member pylint directive
"""Initialize a new Light accessory object.""" | ||
super().__init__(name, entity_id, CATEGORY_LIGHT, *args, **kwargs) | ||
super().__init__(name, entity_id, CATEGORY_LIGHT, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your parent class constructor signature does not have entity_id
, but you seem to include it here?
def __init__(self, name=ACCESSORY_NAME, model=ACCESSORY_MODEL,
category='OTHER', **kwargs):
@kellerza I know what you mean. Currently the However, I wouldn't want to change that at the moment, since I don't instantiate a |
* For added lights
Even if you update HAP-Python, this design is still questionable!! But hey, don’t mind the reviewers... |
I'm sorry I merged this, but there are three other PR's depending on this and it will be addressed later. |
Description:
Extracted from #13534, to get merged quicker for #13625
self._entity.id
toself.entity_id
STATE_OFF
CATEGORY
constants*args
from accessory typesself._hass
toself.hass
Checklist:
tox
. Your PR cannot be merged unless tests pass