diff --git a/homeassistant/components/device_tracker/fritz.py b/homeassistant/components/device_tracker/fritz.py index df439a4fb24..73c2e98792f 100644 --- a/homeassistant/components/device_tracker/fritz.py +++ b/homeassistant/components/device_tracker/fritz.py @@ -1,47 +1,12 @@ """ homeassistant.components.device_tracker.fritz -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Unfortunately, you have to execute the following command by hand: -sudo apt-get install libxslt-dev libxml2-dev - -Device tracker platform that supports scanning a FitzBox router for device +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Device tracker platform that supports scanning a FRITZ!Box router for device presence. -Configuration: - -To use the fritz tracker you have to adapt your configuration.yaml by -using the following template: - -device_tracker: - platform: fritz - host: YOUR_ROUTER_IP - username: YOUR_ADMIN_USERNAME - password: YOUR_ADMIN_PASSWORD - - -Description: - -host -*Optional -The IP address of your router, e.g. 192.168.0.1. -It is optional since every fritzbox is also reachable by using -the 169.254.1.1 IP. - -username -*Optional -The username of an user with administrative privileges, usually 'admin'. -However, it seems that it is not necessary to use it in -current generation fritzbox routers because the necessary data -can be retrieved anonymously. - -password -*Optional -The password for your given admin account. -However, it seems that it is not necessary to use it in current -generation fritzbox routers because the necessary data can -be retrieved anonymously. +For more details about this platform, please refer to the documentation at +https://home-assistant.io/components/device_tracker.fritz/ """ - import logging from datetime import timedelta @@ -58,16 +23,12 @@ _LOGGER = logging.getLogger(__name__) # noinspection PyUnusedLocal def get_scanner(hass, config): - """ - Validates config and returns FritzBoxScanner - @param hass: - @param config: - @return: - """ + """ Validates config and returns FritzBoxScanner. """ if not validate_config(config, {DOMAIN: []}, _LOGGER): return None + scanner = FritzBoxScanner(config[DOMAIN]) return scanner if scanner.success_init else None @@ -75,14 +36,14 @@ def get_scanner(hass, config): # pylint: disable=too-many-instance-attributes class FritzBoxScanner(object): """ - This class queries a FritzBox router. It is using the + This class queries a FRITZ!Box router. It is using the fritzconnection library for communication with the router. The API description can be found under: https://pypi.python.org/pypi/fritzconnection/0.4.6 - This scanner retrieves the list of known hosts and checks - their corresponding states (on, or off). + This scanner retrieves the list of known hosts and checks their + corresponding states (on, or off). Due to a bug of the fritzbox api (router side) it is not possible to track more than 16 hosts. @@ -113,7 +74,7 @@ class FritzBoxScanner(object): if CONF_PASSWORD in config.keys(): self.password = config[CONF_PASSWORD] - # Establish a connection to the fritzbox + # Establish a connection to the FRITZ!Box try: self.fritz_box = fc.FritzHosts(address=self.host, user=self.username, @@ -131,7 +92,7 @@ class FritzBoxScanner(object): self.fritz_box.modelname) self._update_info() else: - _LOGGER.error("Failed to establish connection to FritzBox " + _LOGGER.error("Failed to establish connection to FRITZ!Box " "with IP: %s", self.host) def scan_devices(self): @@ -152,10 +113,7 @@ class FritzBoxScanner(object): @Throttle(MIN_TIME_BETWEEN_SCANS) def _update_info(self): - """ - Retrieves latest information from the FritzBox. - Returns boolean if scanning successful. - """ + """ Retrieves latest information from the FRITZ!Box. """ if not self.success_init: return False