Closed DirkMu closed 2 months ago
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.
All lights and swiches were restored. Only those switches with category config weren’t.
🤔 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
👍 yep, already found the bug. Will file a PR later.
👌 What's the cause for the error? Will you fix the restorage? Or will you fix the abovementioned error?
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?
Should work with 2024.9.3
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.
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.