-
-
Notifications
You must be signed in to change notification settings - Fork 31.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
Allow overriding name via entity registry #12292
Conversation
@@ -61,6 +61,7 @@ | |||
'chardet==3.0.4', | |||
'astral==1.5', | |||
'certifi>=2017.4.17', | |||
'attrs==17.4.0', |
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.
This introduces attrs to the codebase as per home-assistant/architecture#4
domain = attr.ib(type=str, default=None, init=False, repr=False) | ||
|
||
def __attrs_post_init__(self): | ||
"""Computed properties.""" |
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.
Do these behave as properties or instance attributes, ie write protected or not?
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.
They are write protected because the class is annotated with frozen=True
. The class is frozen after the post_init has run. It allows me to operate on the values entered before it's frozen.
you have to read the 2 methods from attr
as attrib and attrs btw. Makes it easier to remember
Will this also fix something like #12287 ? |
* Allow overriding name via entity registry * Update requirements
Included this in 0.63.1 because another PR had a test that used something from this PR and can't be bothered to split it up. |
Do I understand this correctly: The final friendly name of an entity is now determined by these things with decreasing priority:
? |
Correct, as it always should have been. |
Description:
This allows overriding the name of an entity via the entity registry.
If a name is defined in the entity registry, it is always used in favor of the name supplied by the device.
Define name by adding a name value under an entry in
entity_registry.yaml
.Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass