cyberjunky / home-assistant-arpscan_tracker

This component tracks devices using the arp-scan liinux command, it's very fast, and reasonably accurate.
MIT License
28 stars 4 forks source link

Default `scan_options` no longer working in docker #17

Closed XanderStrike closed 4 weeks ago

XanderStrike commented 3 months ago

Thanks for this project, I've been using it happily for a very long time.

After the 1.0.7 release I noticed tracking was no longer working for my devices, finally took the time to dig into it today.

It turns out that arp-scan with the default arguments specified here cause it to choke on docker-provided veth devices:

$ docker exec -it homeassistant sh
/config # arp-scan -l -g -t1 -q
WARNING: Could not obtain IP address for interface veth187eb0b. Using 0.0.0.0 for
the source address, which may not be what you want.
Either configure veth187eb0b with an IP address, or manually specify the address
with the --arpspa option.
Interface: veth187eb0b, type: EN10MB, MAC: 36:ee:52:ca:1c:0b, IPv4: (none)
ERROR: Could not obtain interface IP address and netmask
ERROR: pcap_lookupnet: veth187eb0b: no IPv4 address assigned

This error was also visible in the home assistant logs after turning on debug logging for arpscan.

Weird veth behavior when it comes to pings and arp tables isn't surprising, they're not meant to be used this way. I'm confused how it ever worked actually, perhaps something has changed with the way arp-scan's --localnet deals with veth interfaces.

In any case, I had to specify the interface in my configuration, which looks like this:

device_tracker:
  - platform: arpscan_tracker
    interval_seconds: 15
    consider_home: 1200
    track_new_devices: false
    scan_options: " --interface=eno1 192.168.0.0/24 -g"

It's now working perfectly again. Just thought I'd share in case other people have this issue

Rcarballo2222 commented 2 months ago

@XanderStrike Tangentially related, but how did you get arp-scan working on the home assistant docker container? I get the following error in the logs:

2024-06-10 21:46:53.110 DEBUG (SyncWorker_7) [custom_components.arpscan_tracker.device_tracker] Scanning...
2024-06-10 21:46:53.119 DEBUG (SyncWorker_7) [custom_components.arpscan_tracker.device_tracker] Scandata /bin/sh: arp-scan: not found
cyberjunky commented 4 weeks ago

Closing because stale ticket