Having just updated from v2.0 to v2.1, I'm starting to see duplicate device_tracker entities (and associated HA devices) being created after each Home Assistant restart. The original entities continue to be updated with the correct status, but there's a series of duplicates created that always have the status 'Away' and cannot be removed.
I've removed and re-added the integration and the issue still persists - on adding there is one copy of each device, subsequent restarts create a duplicate each time.
How to reproduce the issue
Restart Home Assistant using Developer Tools > YAML > Restart
Expected behaviour
Device tracking works as expected, but the large number of duplicates should not be there.
Screenshots
As shown in the device screen:
Software versions
Home Assistant version: HA 2022.08.5
Mikrotik Router integration version: v2.1
Mikrotik Hardware: CCR1009-7G-1C-1S+
RouterOS version: v6.47.10
Traceback/Error logs
I have a large number of tracked devices (over 100), so turning on verbose logging resulted in huge logs and I didn't see anythign at first glance.
I did spot the following in the .storage/core.device_registry file.
The initial device works as expected (this is an ESPhome device, so multiple config entries, and many details supplied from there):
The IDs in connections continue to grow in the same format, with each new one adding ROUTER-HOST to the front. I've got up to 7 duplicates in the same format before removing and reinstalling the integration.
Again, it looks like the unique_id field grows by pre-pending router-host each time.
Additional context
I have another four Mikrotik devices on the network and installed in Home Assistant, although only this one does device tracking (the others are switches and APs using CAPsMAN).
Describe the issue
Having just updated from v2.0 to v2.1, I'm starting to see duplicate device_tracker entities (and associated HA devices) being created after each Home Assistant restart. The original entities continue to be updated with the correct status, but there's a series of duplicates created that always have the status 'Away' and cannot be removed.
I've removed and re-added the integration and the issue still persists - on adding there is one copy of each device, subsequent restarts create a duplicate each time.
How to reproduce the issue
Restart Home Assistant using Developer Tools > YAML > Restart
Expected behaviour
Device tracking works as expected, but the large number of duplicates should not be there.
Screenshots
As shown in the device screen:![image](https://user-images.githubusercontent.com/62269312/184887347-a80a44c0-0344-44d1-a3c0-683fec9febba.png)
Software versions
Traceback/Error logs
I have a large number of tracked devices (over 100), so turning on verbose logging resulted in huge logs and I didn't see anythign at first glance.
I did spot the following in the
.storage/core.device_registry
file.The initial device works as expected (this is an ESPhome device, so multiple config entries, and many details supplied from there):
The first duplicate take this format:
and the third:
The IDs in
connections
continue to grow in the same format, with each new one adding ROUTER-HOST to the front. I've got up to 7 duplicates in the same format before removing and reinstalling the integration.Similarly in
.storage/entity_registry
we have:followed by:
and:
Again, it looks like the
unique_id
field grows by pre-pending router-host each time.Additional context
I have another four Mikrotik devices on the network and installed in Home Assistant, although only this one does device tracking (the others are switches and APs using CAPsMAN).