AlexandrErohin / home-assistant-tplink-router

Home Assistant component for TP-Link router administration with sensors, button reboot, switches and device tracking.
https://community.home-assistant.io/t/custom-component-tp-link-router-integration
MIT License
73 stars 7 forks source link
archer-a7 archer-ax10 archer-ax11000 archer-ax20 archer-ax3000 archer-ax50 archer-c1200 archer-c6 archer-mr200 custom-component deco gdpr hacs hacs-integration home-assistant homeassistant integration tl-wa3001 tp-link tplink

Tp-Link router integration for Home Assistant

Home Assistant component for TP-Link router administration based on the TP-Link Router API

[!WARNING] Please temporarily disable the integration before accessing the router admin page. TP-Link admin page only allows one user at a time. This integration will log you out of the admin page every time it scans for updates (every 30s by default).

See Supported routers

Components

Events

Switches

Sensors

Device Tracker

To find your device - Go to Developer tools and search for your MAC address - you’ll find sensor like device_tracker.YOUR_MAC or device_tracker.YOUR_PHONE_NAME.

It will also fire Home Assistant event when a device connects to router

Notification

To receive notifications of appearing a new device in your network, or becoming device online\offline add following lines to your configuration.yaml file:

automation:
  - alias: "New network device"
    trigger:
      platform: event
      event_type: tplink_router_new_device
    action:
      service: notify.mobile_app_<device_name>
      data:
        content: >-
          New device appear {{ trigger.event.data.hostname }} with IP {{ trigger.event.data.ip_address }}

All available fields in trigger.event.data:

Installation

HACS (recommended)

Have HACS installed, this will allow you to update easily.

Install quickly via a HACS link

  1. Go to the Hacs->Integrations.
  2. Add this repository (https://github.com/AlexandrErohin/home-assistant-tplink-router) as a custom repository
  3. Click on + Explore & Download Repositories, search for TP-Link Router.
  4. Search for TP-Link Router.
  5. Navigate to TP-Link Router integration
  6. Press DOWNLOAD and in the next window also press DOWNLOAD.
  7. After download, restart Home Assistant.

Manual

  1. Locate the custom_components directory in your Home Assistant configuration directory. It may need to be created.
  2. Copy the custom_components/tplink_router directory into the custom_components directory.
  3. Restart Home Assistant.

Configuration

TP-Link Router is configured via the GUI. See the HA docs for more details.

The default data is preset already.

  1. Go to the Settings->Devices & services.
  2. Click on + ADD INTEGRATION, search for TP-Link Router.
  3. Fill Password.
  4. Click SUBMIT

NOTE!

  1. If you use https connection to your router you may get error certificate verify failed: EE certificate key too weak. To fix this - unset Verify ssl
  2. Use Local Password which is for Log In with Local Password
  1. If you got error - You need to use web encrypted password instead. Check the documentation! Read web encrypted password
  2. The TP-Link Web Interface only supports upto 1 user logged in at a time (for security reasons, apparently). So you will be logged out from router web interface when the integration updates data

Web Encrypted Password

If you got error - You need to use web encrypted password instead. Check the documentation!

  1. Go to the login page of your router. (default: 192.168.0.1).
  2. Type in the password you use to login into the password field.
  3. Click somewhere else on the page so that the password field is not selected anymore.
  4. Open the JavaScript console of your browser (usually by pressing F12 and then clicking on "Console").
  5. Type document.getElementById("login-password").value;
  6. Copy the returned value as password and use it.

Edit Configuration

You may edit configuration data like:

  1. Router url
  2. Password
  3. Scan interval
  4. Verify https

To do that:

  1. Go to the Settings->Devices & services.
  2. Search for TP-Link Router, and click on it.
  3. Click on CONFIGURE
  4. Edit the options you need and click SUBMIT

Supported routers

Fully tested Hardware Versions

Not fully tested Hardware Versions

Please let me know if you have tested integration with one of this or other model. Open an issue with info about router's model, hardware and firmware versions.

Adding Support For More Models

Guidelines CONTRIBUTING.md