Skip to content

Commit

Permalink
Fixed duplication of tracker entities for restored entities #236
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaae committed Aug 17, 2022
1 parent cbac88e commit d420a8a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion custom_components/mikrotik_router/mikrotik_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,17 @@ async def async_get_host_hass(self):
entity.config_entry_id == self.config_entry.entry_id
and entity.entity_id.startswith("device_tracker.")
):
self.data["host_hass"][entity.unique_id.upper()] = entity.original_name
tmp = entity.unique_id.split("-")
if tmp[0] != self.name.lower():
continue

if tmp[1] != "host":
continue

if ":" not in tmp[2]:
continue

self.data["host_hass"][tmp[2].upper()] = entity.original_name

# ---------------------------
# async_hwinfo_update
Expand Down

0 comments on commit d420a8a

Please sign in to comment.