Fixed duplication of tracker entities for restored entities #236

This commit is contained in:
Tomaae 2022-08-17 09:29:46 +02:00
parent cbac88efd2
commit d420a8ad06
No known key found for this signature in database
GPG key ID: 8360BBD8A381D1C0

View file

@ -469,7 +469,17 @@ class MikrotikControllerData:
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