I am having trouble with nmap_tracker. I have attempted to narrow this down to a single case with my current configuration, which looks like:
- platform:
scan_options: " --privileged -sP "
track_new_devices: yes
hosts: 192.168.1.2 # Just a single host for testing
I have turned up logging in the logger section:
homeassistant.components.device_tracker: debug
I get the following in my log:
2018-04-24 16:26:17 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.nmap_tracker
2018-04-24 16:26:17 INFO (Thread-16) [homeassistant.components.device_tracker.nmap_tracker] Scanner initialized
2018-04-24 16:26:17 INFO (Thread-10) [homeassistant.components.device_tracker.nmap_tracker] Scanning...
2018-04-24 16:26:17 INFO (Thread-10) [homeassistant.components.device_tracker.nmap_tracker] nmap scan successful
However, no new devices appear in known_devices (other device_trackers are not have problems changing the file), and I don’t see any new device_tracker.* entities appearing. What am I missing?
$ sudo apt-get install net-tools nmap
Reading package lists... Done
Building dependency tree
Reading state information... Done
net-tools is already the newest version (1.60+git20161116.90da8a0-1).
nmap is already the newest version (7.40-1).
All dependencies seem to work from the command line without an error. The single device I am testing is a phone, but I changed to an always-connected device to verify…same issue.
Let me understand, though…I had assumed that if the device does not respond, a device_tracker entry indicating “not home” would be created. In other words, the entity is created regardless of connectivity, and the device_tracker state indicates if it’s successful. Is this not the case? Does it have to succeed once to create the entity?
I would assume it would need a response at least once. The known_devices.yaml file will be by mac address (for nmap at least) so it will need a response to populate that info.
I would test it with a non mobile device first. At least you can rule that variable out. Set it to scan a computer/laptop that is on and running.
I had misunderstood, or not thought about the implications of a network scanner (specifically, you cannot create known_devices.yaml entries until you succeed). Since I was testing a single device…I just assumed it would create the entry. Bad assumption! It was a bad ping, and it did create then entry after the first time the device responds. Thanks for getting me back on track.