Skip to content
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

Switches entity_category: config not restored #174

Closed
DirkMu opened this issue Sep 18, 2024 · 8 comments · Fixed by home-assistant/core#126290
Closed

Switches entity_category: config not restored #174

DirkMu opened this issue Sep 18, 2024 · 8 comments · Fixed by home-assistant/core#126290

Comments

@DirkMu
Copy link

DirkMu commented Sep 18, 2024

I created switched from KNX frontend weeks ago. Today I removed the config entry in order to test something. Afterwards all switches created from frontend that used entity_category: config were not restored.

@farmio
Copy link
Member

farmio commented Sep 18, 2024

I think that if you delete the knx ConfigEntry none of the UI-entities are restored, are they? entity_category shouldn't make any difference for that.

@DirkMu
Copy link
Author

DirkMu commented Sep 19, 2024

All lights and swiches were restored. Only those switches with category config weren’t.

@DirkMu
Copy link
Author

DirkMu commented Sep 19, 2024

🤔 I added them but now I get the following error when restarting:

ERROR (MainThread) [homeassistant.components.switch] Error adding entity None for domain switch with platform knx Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 809, in _async_add_entity entry = entity_registry.async_get_or_create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 849, in async_get_or_create _validate_item( File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 678, in _validate_item raise ValueError( ValueError: entity_category must be a valid EntityCategory instance, got config

@farmio
Copy link
Member

farmio commented Sep 19, 2024

👍 yep, already found the bug. Will file a PR later.

@DirkMu
Copy link
Author

DirkMu commented Sep 19, 2024

👌
What's the cause for the error?
Will you fix the restorage? Or will you fix the abovementioned error?

@farmio
Copy link
Member

farmio commented Sep 19, 2024

Afaic those are the same errors.

But imho, restoration shouldn't even be possible. Deleting the config entry should also delete all UI entity config... it doesn't now as I didn't think of it, but what else would be the point of deletion?

@farmio
Copy link
Member

farmio commented Sep 20, 2024

Should work with 2024.9.3

@farmio farmio closed this as completed Sep 20, 2024
@DirkMu
Copy link
Author

DirkMu commented Sep 25, 2024

Yes, you are right. Deleting the config entry is supposed to delete the entities associated to it as well. Wasn't a good idea. So, the restoration was unintentional. I still wonder why there were restored.

I updated to 2024.9.3. The error in the log is gone but the first restart duplicated all switches with entity_category: config.

I deleted all duplicates manually. Now, all seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants