Skip to main content

TP-link WiFi Router Controller

Installation

pip install tp-link-controller

Usage

  1. Install JDK-8
    • Using Chocolatey: choco install jdk8
  2. Download browsermob-proxy pass the binary path to TP_Link_controller object.
from TPLinkController import controller

email = "xyz@examplemail.com"
password = "topSecret"

bmp_path = r"bin\browsermob-proxy-2.1.4\bin\browsermob-proxy"

tplink = controller.TP_Link_Controller(email, password, browsermobproxy_location=bmp_path, DEBUG_MODE=True)

By default chrome runs in headless mode (NO UI WILL OPEN) If DEBUG_MODE is True or headless option is True, it will open chrome.

Note: Login before doing anything

tplink.login()

The following methods are available

  1. .login() -> Logins to the admin panel
  2. .close() -> Exits the browser and closes the proxy
  3. .get_status() -> Returns a dictionary with a lot of status information.
  4. .turn_on_2G() -> Turns on 2.4G WiFi.
  5. .turn_on_5G() -> Turns on 5G WiFi.
  6. .turn_off_2G() -> Turns off 2.4G WiFi.
  7. .turn_off_5G() -> Turns off 5G WiFi.
  8. .toggle_2g_wifi() -> Toggles 2.4G WiFi
  9. .toggle_5g_wifi() -> Toggles 5G WiFi
  10. .is_2g_on() -> Returns True if 2.4G WiFi is on else False.
  11. .is_5g_on() -> Returns True if 5G WiFi is on else False.
  • Based on Selenium.
  • Uses the WebUI as you would normally do.
  • Made due to the lack of any kind of API to interact with any TP-Link Routers.

Tested On:

    • Hardware: Archer C1200 v2.0
    • Firmware Version: 2.0.2 Build 20180118 rel.38979 (EU)

To get started with package dev:

  1. Clone the repository.
  2. Create a virtual environment.
  3. Install all the packages from requirements.txt
  4. Install JDK-8
    • Using Chocolatey
    choco install jdk8
    
  5. Download Browsermob-proxy.
    • For windows, leave it as default, should work out of the box.
    • Pass it to the instance in code.
    • tplink = TP_Link_Controller(email, password, browsermobproxy_location=r"bin\browsermob-proxy-2.1.4\bin\browsermob-proxy", DEBUG_MODE=True)
      
  6. Download the Chrome webdriver and place it in ./bin/ folder for windows.
  7. For Raspberry Pi install .deb packages from here. No need to set bin path, packages will be installed in right directory.

Release files for tp-link-controller 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tp-link-controller 0.0.2
File Size Uploaded
tp-link-controller-0.0.2.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tp-link-controller 0.0.2
File Interpreter ABI Platform
tp_link_controller-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page