mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 13:26:54 +00:00
Update nmap_tracker for config flow (#17786)
This commit is contained in:
parent
6e1919a808
commit
9ba43b8cc7
@ -8,6 +8,7 @@ ha_iot_class: Local Polling
|
||||
ha_domain: nmap_tracker
|
||||
ha_platforms:
|
||||
- device_tracker
|
||||
ha_config_flow: true
|
||||
---
|
||||
|
||||
As an alternative to the router-based device tracking, it is possible to directly scan the network for devices by using Nmap. The IP addresses to scan can be specified in any format that Nmap understands, including the network-prefix notation (`192.168.1.1/24`) and the range notation (`192.168.1.1-255`).
|
||||
@ -24,66 +25,7 @@ On a Fedora host run `sudo dnf -y install nmap`.
|
||||
|
||||
</div>
|
||||
|
||||
Host detection is done via Nmap's "fast scan" (`-F`) of the most frequently used 100 ports, with a host timeout of 5 seconds.
|
||||
|
||||
To use this device tracker in your installation, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
device_tracker:
|
||||
- platform: nmap_tracker
|
||||
hosts: 192.168.1.0/24
|
||||
```
|
||||
|
||||
{% configuration %}
|
||||
hosts:
|
||||
description: The network address to scan (in any supported Nmap format). Mixing subnets and IPs is possible.
|
||||
required: true
|
||||
type: string
|
||||
home_interval:
|
||||
description: The number of minutes Nmap will not scan this device, assuming it is home, in order to preserve the device battery.
|
||||
required: false
|
||||
type: integer
|
||||
exclude:
|
||||
description: Hosts not to include in Nmap scanning. Scanning the host where Home Assistant is running can cause problems (websocket error and authentication failures), so excluding that host is a good idea.
|
||||
required: false
|
||||
type: list
|
||||
scan_options:
|
||||
description: Configurable scan options for Nmap.
|
||||
required: false
|
||||
default: -F --host-timeout 5s
|
||||
type: string
|
||||
{% endconfiguration %}
|
||||
|
||||
## Examples
|
||||
|
||||
A full example for the `nmap` tracker could look like the following sample:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry for Nmap
|
||||
# One whole subnet, and skipping two specific IPs.
|
||||
device_tracker:
|
||||
- platform: nmap_tracker
|
||||
hosts: 192.168.1.0/24
|
||||
home_interval: 10
|
||||
exclude:
|
||||
- 192.168.1.12
|
||||
- 192.168.1.13
|
||||
```
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml for Nmap
|
||||
# One subnet, and two specific IPs in another subnet.
|
||||
device_tracker:
|
||||
- platform: nmap_tracker
|
||||
hosts:
|
||||
- 192.168.1.0/24
|
||||
- 10.0.0.2
|
||||
- 10.0.0.15
|
||||
```
|
||||
|
||||
In the above example, Nmap will be call with the process:
|
||||
`nmap -oX - 192.168.1.1/24 10.0.0.2 10.0.0.15 -F --host-timeout 5s`
|
||||
{% include integrations/config_flow.md %}
|
||||
|
||||
An example of how the Nmap scanner can be customized:
|
||||
|
||||
@ -95,12 +37,6 @@ On Linux systems (such as Hass.io) you can extend the functionality of Nmap, wit
|
||||
sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip /usr/bin/nmap
|
||||
```
|
||||
|
||||
And you can set up the device tracker as
|
||||
|
||||
```yaml
|
||||
- platform: nmap_tracker
|
||||
hosts: 192.168.1.1-25
|
||||
scan_options: " --privileged -sn "
|
||||
```
|
||||
And you can set up the device tracker scan options with `--privileged -sn`
|
||||
|
||||
See the [device tracker integration page](/integrations/device_tracker/) for instructions how to configure the people to be tracked.
|
||||
|
Loading…
x
Reference in New Issue
Block a user