Minor style changes, cleanup#13654
Minor style changes, cleanup#13654cdce8p merged 2 commits intohome-assistant:devfrom cdce8p:homekit-style-changes
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'
| 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.
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
| def __init__(self, hass, entity_id, name, **kwargs): | ||
| """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.
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.idtoself.entity_idSTATE_OFFCATEGORYconstants*argsfrom accessory typesself._hasstoself.hassChecklist:
tox. Your PR cannot be merged unless tests pass