Skip to content

Commit

Permalink
fixed handling of unavailable devices when device tracking is turned off
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaae committed Apr 11, 2020
1 parent d189ad8 commit 897d5dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions custom_components/mikrotik_router/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ def update_items(inst, config_entry, mikrotik_controller, async_add_entities, tr
[MikrotikControllerPortDeviceTracker, MikrotikControllerHostDeviceTracker],
):
for uid in mikrotik_controller.data[sid]:
if (
not config_entry.options.get(CONF_TRACK_HOSTS, DEFAULT_TRACK_HOSTS)
and sid == "host"
):
continue
item_id = f"{inst}-{sid}-{mikrotik_controller.data[sid][uid][sid_uid]}"
_LOGGER.debug("Updating device_tracker %s", item_id)
if item_id in tracked:
Expand Down

0 comments on commit 897d5dc

Please sign in to comment.