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

Device multiplication #13

Closed
Edo78 opened this issue Nov 16, 2020 · 8 comments
Closed

Device multiplication #13

Edo78 opened this issue Nov 16, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@Edo78
Copy link

Edo78 commented Nov 16, 2020

After restarting HA the log begin to show some warnings

2020-11-16 21:44:56 WARNING (SyncWorker_28) [homeassistant.util.yaml.loader] YAML file /config/known_devices.yaml contains duplicate key "mi_smart_band_5". Check lines 85 and 155
2020-11-16 21:44:56 WARNING (SyncWorker_28) [homeassistant.util.yaml.loader] YAML file /config/known_devices.yaml contains duplicate key "mi_band_2". Check lines 99 and 162
2020-11-16 21:44:56 WARNING (SyncWorker_28) [homeassistant.util.yaml.loader] YAML file /config/known_devices.yaml contains duplicate key "edo". Check lines 106 and 169
2020-11-16 21:44:56 WARNING (SyncWorker_28) [homeassistant.util.yaml.loader] YAML file /config/known_devices.yaml contains duplicate key "mi_smart_band_5". Check lines 155 and 176
2020-11-16 21:44:56 WARNING (SyncWorker_28) [homeassistant.util.yaml.loader] YAML file /config/known_devices.yaml contains duplicate key "44_8c_c8_04_2a_99". Check lines 183 and 197
2020-11-16 21:44:56 WARNING (SyncWorker_28) [homeassistant.util.yaml.loader] YAML file /config/known_devices.yaml contains duplicate key "mi_band_2". Check lines 162 and 211
2020-11-16 21:44:56 WARNING (SyncWorker_28) [homeassistant.util.yaml.loader] YAML file /config/known_devices.yaml contains duplicate key "edo". Check lines 169 and 218

and known_devices.yaml is full of duplicated devices

Maybe the new "add devices" function should check if the device already exists

@Drakulix
Copy link
Owner

I thought this is taken care of by the device_tracker api, I will investigate. Thanks for reporting

@Drakulix Drakulix added the bug Something isn't working label Nov 17, 2020
@Drakulix
Copy link
Owner

Okay, I have figured out the issue.
The DeviceTracker class, that I currently use is supposed to be a singleton. There is sadly no way to access the singleton however with this component, as it is not available anymore to components using the config_entry platform setup (as far as I understand it).

So as a hotfix, this DeviceScanner just needs to skip writing to the known_devices.yaml (as we cannot synchronize it properly) and disable the "Track new devices"-option (keeping it always on).

The better fix in the long run is migrating to the new device_tracker platform, as outlined in #12.

Drakulix added a commit that referenced this issue Nov 17, 2020
@Drakulix
Copy link
Owner

@Edo78 I have pushed a hotfix to the master branch. Can you update to the master-branch, stop home assistant, cleanup your known_devices.yaml and then verify, that this does not happen anymore?

If it works, I am going to push another hotfix release.

@Edo78
Copy link
Author

Edo78 commented Nov 17, 2020

I honestly don't know how to force an update from master. I will check later and update you on the results

@Drakulix
Copy link
Owner

I honestly don't know how to force an update from master. I will check later and update you on the results

If you are using HACS you can select "Reinstall" and select "master" from the version list.

@Edo78
Copy link
Author

Edo78 commented Nov 17, 2020

Easier than I think.
I followed your instruction and restarted HA 3 times (just to be sure) and known_devices.yaml now doesn't contains duplicated devices anymore.
The issue looks solved

@Drakulix
Copy link
Owner

Cool 👍

@Drakulix
Copy link
Owner

Released as v0.3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants