Help with Fritz Device tracker and arpscan Device tracker

Hello, I don´t know how to approach this problem the right way:

Since my start with HA, I´m using the Fritz device_tracker, although it´s known for keeping the device “home” way to long, even if the device already left minutes ago. (Not a HA issue, more a Fritzbox one)

Now, I would like make some lovelace cards with Plugs in my garden, so I need to track them, wether they are connected with WIFI or not.

In HACS, I found the “arpscan device tracker”, which sounds promising about the update time, so I installed it and editied my existing config this way:

device_tracker:
  - platform: fritz
    host: 192.168.1.254
    track_new_devices: yes
    
  - platform: arpscan_tracker
    interval_seconds: 15
    consider_home: 30
    track_new_devices: true
    include:
      - 192.168.1.17
      - 192.168.1.35
      - 192.168.1.158

Well it doesn´t really work, as the fritz_tracker is always the one which sets the device to “not_home”, not the arpscan_tracker.
I tried to exclude the IP adresses I used with arpscan_tracker in the fritz section, but this is not supported from the fritz device tracker.

Is there anything I can do about it, or do I have to get rid of one device_tracker?

Thank you and a nice saturday,
Philipp

Hi Philipp,

i had the same question some months before and I have not found a simple solution. I ended up with creating a copy of the fritz component into the custom_component folder and added a MAC-address-exclude option to the integration. (this will overwrite the default fritz sensor and yes it is ugly…)

Changes that I have done in the custom_components/fritz/device_tracker.py:

  1. Add import CONF_EXCLUDE to line 13
    Original:
    from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
    New:
    from homeassistant.const import CONF_EXCLUDE, CONF_HOST, CONF_PASSWORD, CONF_USERNAME

  2. Add optional configuration option
    Old:

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
        vol.Optional(CONF_USERNAME, default=DEFAULT_USERNAME): cv.string,
        vol.Optional(CONF_PASSWORD): cv.string,
    }
)

New:

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
        vol.Optional(CONF_USERNAME, default=DEFAULT_USERNAME): cv.string,
        vol.Optional(CONF_PASSWORD): cv.string,
        vol.Optional(CONF_EXCLUDE, default=[]):
            vol.All(cv.ensure_list, [cv.string]),
    }
)

  1. Add attribute to the __init__ method
    Original:
    def __init__(self, config):
        """Initialize the scanner."""
        self.last_results = []
        self.host = config[CONF_HOST]
        self.username = config[CONF_USERNAME]
        self.password = config.get(CONF_PASSWORD)
        self.success_init = True

New:

    def __init__(self, config):
        """Initialize the scanner."""
        self.last_results = []
        self.host = config[CONF_HOST]
        self.username = config[CONF_USERNAME]
        self.password = config.get(CONF_PASSWORD)
        self.exclude = config.get(CONF_EXCLUDE)
        self.success_init = True
  1. Add Exclude filter to the scan_devices method:
    Original:
            if known_host["status"] and known_host.get("mac"):

new:

            if known_host["status"] and known_host.get("mac") and known_host.get("mac") not in self.exclude:
  1. Added exclude option to configuration.yaml
  - platform: fritz
    host: 192.168.178.1
    track_new_devices: yes
    exclude:
      - 16:1C:xx:xx:xx:xx

Now i have to check every release if something important has changed in the original component. But the change rate is low.

Again, not a good but a working solution.

BTW, you should check if the arpscan tracker really works. On a lot of systems “arp-scan” is not installed by default and it needs special security settings to run as normal user. (set log level to debug to check.)

Thank you very much for your reply - I guess I´ll put this aside for the moment until there is a “pretty” solution (if ever - maybe it´s a feature request for AVM to decrease the time to mark a device offline).