update header

This commit is contained in:
Fabian Affolter 2015-05-11 18:06:12 +02:00
parent 61e1f56922
commit 6b42227b13

View File

@ -1,4 +1,25 @@
""" Supports scanning using nmap. """ """
homeassistant.components.device_tracker.nmap
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Device tracker platform that supports scanning a network with nmap.
Configuration:
To use the nmap tracker you will need to add something like the following
to your config/configuration.yaml
device_tracker:
platform: nmap_tracker
hosts: 192.168.1.1/24
Variables:
hosts
*Required
The IP addresses to scan in the network-prefix notation (192.168.1.1/24) or
the range notation (192.168.1.1-255).
"""
import logging import logging
from datetime import timedelta, datetime from datetime import timedelta, datetime
from collections import namedtuple from collections import namedtuple
@ -36,7 +57,7 @@ Device = namedtuple("Device", ["mac", "name", "ip", "last_update"])
def _arp(ip_address): def _arp(ip_address):
""" Get the MAC address for a given IP """ """ Get the MAC address for a given IP. """
cmd = ['arp', '-n', ip_address] cmd = ['arp', '-n', ip_address]
arp = subprocess.Popen(cmd, stdout=subprocess.PIPE) arp = subprocess.Popen(cmd, stdout=subprocess.PIPE)
out, _ = arp.communicate() out, _ = arp.communicate()