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
Remove device from known_devices upon import in ping device tracker #105009
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
|
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
…ping-delete-known-devices
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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.
Looks good!
…105009) Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Thanks @MartinHjelmare |
Proposed change
If the YAML is imported via the config flow and the device still exists in
known_devices.yaml
, the config entry will suffix the new entity with_2
as the entity is already used by thedevice_tracker
platform which restores the entities fromknown_devices.yaml
on restart.This PR solves this problem by delaying the import of the device tracker after the start of the HA and then checking if there is already a state with this entity ID and if the device exists in
known_devices.yaml
before the import is triggered. If this is the case, the device is deleted fromknown_devices.yaml
and the state machine and the import is triggered.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
..coveragerc
.To help with the load of incoming pull requests: