-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Add config subentry support to entity registry #128155
Add config subentry support to entity registry #128155
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
4842a7c
to
8d6853d
Compare
Frontend is approved: home-assistant/frontend#23160 |
8d6853d
to
23fc272
Compare
23fc272
to
242226b
Compare
242226b
to
7292531
Compare
7292531
to
048e642
Compare
@@ -1431,7 +1562,7 @@ async def test_remove_config_entry_from_device_removes_entities_2( | |||
config_entry_2.entry_id, | |||
} | |||
|
|||
# Create one entity for each config entry | |||
# Create an entity without config entry |
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.
Side note: It's weird to have an entity entry connected to a device entry but not connected to the config entry of the device entry. Should that even be allowed?
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.
No, it's indeed weird, and I think we should add validation to prevent it in a follow-up
"light", | ||
"hue", | ||
"5678", | ||
device_id=device_entry.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.
When does an integration connect its entities to another integration's device without having a config entry of its own?
I was thinking maybe the template integration but that only links to devices when set up from a config entry.
The entity platform helper code doesn't support connecting a device via device_info
if the added entity doesn't have a config entry.
The only place in our codebase I found that created an entity entry directly via async_get_or_create
without a config entry was the TagEntity
which doesn't connect to a device entry.
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.
There's probably no valid case, I just added tests to assert behavior for various cases
Proposed change
Add config subentry support to entity registry
This is intended as a follow-up to #117355
Needs #128157
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: