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

Work around device tracker component deleting devices #1

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Conversation

pnbruckner
Copy link
Owner

The device tracker component level code deletes any registered devices that are associated only with device_tracker entities. Not only that, but it will also (indirectly) delete those entities from the entity registry. This code was meant to fix behavior of older HA versions and was supposed to have been removed after 2022.6, but never was. Here is the culprit:

https://github.com/home-assistant/core/blob/78c1efa7d4b3faaf6a2bf63d71a64095453e0c97/homeassistant/components/device_tracker/config_entry.py#L54-L74

The result is that any user modifications stored in the entity registry are lost.

This change works around that code & problem by disassociating the device_tracker entities from their devices at shutdown so that at startup, the device tracker component level code won't try to delete the devices. When this integration is loaded (i.e., setup), it will reassociate the entities with their corresponding devices.

@pnbruckner pnbruckner merged commit 6a159f5 into main Mar 28, 2024
4 checks passed
@pnbruckner pnbruckner deleted the devices branch March 28, 2024 18:43
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 this pull request may close these issues.

1 participant