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
Subscribe to device registry changes from entities #93601
Conversation
61b5684
to
7f99b75
Compare
homeassistant/helpers/entity.py
Outdated
if not self._attr_name: | ||
return True | ||
return False |
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.
if not self._attr_name: | |
return True | |
return False | |
return not self._attr_name |
homeassistant/helpers/entity.py
Outdated
if not self.entity_description.name: | ||
return True | ||
return False |
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.
if not self.entity_description.name: | |
return True | |
return False | |
return not self.entity_description.name |
homeassistant/helpers/entity.py
Outdated
if not self.name: | ||
return True | ||
|
||
return False |
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.
if not self.name: | |
return True | |
return False | |
return not self.name |
testing performance now |
homeassistant/helpers/entity.py
Outdated
def _name_translation_key(self) -> str | None: | ||
"""Return translation key for entity name.""" | ||
if self.translation_key is None: | ||
return None | ||
assert self.platform | ||
return ( | ||
f"component.{self.platform.platform_name}.entity.{self.platform.domain}" | ||
f".{self.translation_key}.name" | ||
) |
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.
Can this change? should we cache it?
startup performance looks good the entity registry subscribes are so much higher on the list. I cleaned that up in #93823 |
noticed in #93601 that the cost of creating the function in the closure was a bit expensive since we do it once per entity
While reviewing #93601 it was noticed this was slow at startup #93601 (comment) This is a first pass attempt to improve the performance
Runtime performance looks good 👍 |
* Use ReadOnlyDict for entity registry options While reviewing #93601 it was noticed this was slow at startup #93601 (comment) This is a first pass attempt to improve the performance * fix tests
noticed in #93601 that the cost of creating the function in the closure was a bit expensive since we do it once per entity
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.
LGTM
Proposed change
Subscribe to device registry changes from entities which don't have their own name
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: