Skip to main content

TP-Link Router API (supports also Mercusys Router)

Python package for API access and management for TP-Link and Mercusys Routers. See Supported routers

Pypi Downloads Python versions

Installation

pip install tplinkrouterc6u

Dependencies

Usage

  • Enter the host & credentials used to log in to your router management page. Username is admin by default. But you may pass username as third parameter. Some routers have default username - user
  • EX series (and some password-only UIs such as EX920): use username user — admin is rejected even when the web UI does not ask for a username
  • Use Local Password which is for Log In with Local Password. Login with TP-LINK ID doesnt work
  • If you use https connection - You need to turn on "Local Management via HTTPS" (advanced->system->administration) in the router web UI
from tplinkrouterc6u import (
    TplinkRouterProvider,
    TplinkRouterV1_11,
    TplinkRouterSG, # For routers like Archer BE3600, Archer BE230
    TplinkRouterAX72,
    TplinkRouter,
    TplinkC1200Router,
    TplinkC5400XRouter,
    TPLinkMRClient, # Class for MR series routers which supports old firmwares with AES cipher CBC mode
    TPLinkMRClientGCM, # Class for MR series routers which supports AES cipher GCM mode
    TPLinkMR200Client,
    TPLinkMR6400v7Client,
    TPLinkMR600Client, # Class for MR series that replaced the RSA key exchange with ECIES over NIST P-224
    TPLinkVRClient,
    TPLinkVR400v2Client,
    TplinkVR1200vRouter,
    TPLinkEXClient, # Class for EX series routers which supports old firmwares with AES cipher CBC mode
    TPLinkEXClientGCM, # Class for EX series routers which supports AES cipher GCM mode
    TPLinkEXClientGCMOAEP, # EX GCM + RSA-OAEP signatures (e.g. EX920)
    TPLinkRClient, # For routers like TL-R470GP-AC
    TPLinkXDRClient,
    TPLinkDecoClient,
    TplinkDecoE4RRouter,
    TPLinkEAP115Client,
    TPLinkCPE210Client,
    TPLinkSG108EClient,
    TplinkC80Router,
    TplinkWDRRouter,
    TPLinkC50Client,
    TPLinkWR841NClient,
    TplinkRE330Router,
    TplinkRE813XERouter,
    TplinkC3200Router,
    Connection
)
from logging import Logger
import traceback

# Prefer the provider: it picks a matching client for your router
router = TplinkRouterProvider.get_client('http://192.168.0.1', 'password')
logger = Logger('test')
# You may use a client class directly, e.g.:
# router = TplinkRouter('http://192.168.0.1', 'password')
# You may also pass username if it is different and a logger to log errors as
# router = TplinkRouter('http://192.168.0.1', 'password', 'admin2', logger=logger)
# C5400X: plain local password works with get_client() / TplinkC1200Router (PKCS#1 fallback).
# TplinkC5400XRouter still needs the web-encrypted value (see Web Encrypted Password below).
# router = TplinkC5400XRouter('http://192.168.0.1', 'WebEncryptedPassword', logger=logger)
# RE813XE / RE700X / similar: use web encrypted password
# router = TplinkRE813XERouter('http://192.168.0.1', 'WebEncryptedPassword', logger=logger)

try:
    # Or: with router:  # authorize on enter, logout on exit
    router.authorize()
    # Get firmware info - returns Firmware
    firmware = router.get_firmware()

    # Get status info - returns Status
    status = router.get_status()
    if not status.guest_2g_enable:  # check if guest 2.4G wifi is disable
        router.set_wifi(Connection.GUEST_2G, True)  # turn on guest 2.4G wifi

    # Get IPv6 status (not implemented on every client → NotImplementedError)
    try:
        ipv6_status = router.get_ipv6_status()
        print(ipv6_status.wan_ipv6_addr, ipv6_status.wan_ipv6_gateway)
    except NotImplementedError:
        pass

    # Get EasyMesh nodes (empty list when the router runs no mesh)
    try:
        for node in router.get_mesh_nodes():
            print(f"{node.name:24} {node.model:16} {node.macaddr} {node.ipaddr:16s} "
                  f"{node.role:16} clients={node.client_num}")
    except NotImplementedError:
        pass

    # Optional methods (not on every client)
    try:
        reservations = router.get_ipv4_reservations()
        reservations.sort(key=lambda a: a.ipaddr)
        for res in reservations:
            print(f"{res.macaddr} {res.ipaddr:16s} {res.hostname:36} {'Permanent':12}")
    except (AttributeError, NotImplementedError):
        pass

    try:
        leases = router.get_ipv4_dhcp_leases()
        leases.sort(key=lambda a: a.ipaddr)
        for lease in leases:
            print(f"{lease.macaddr} {lease.ipaddr:16s} {lease.hostname:36} {lease.lease_time:12}")
    except (AttributeError, NotImplementedError):
        pass

    router.logout()  # always logout; TP-Link Web Interface only supports up to 1 user logged in
except Exception as e:
    logger.error(traceback.format_exc())

The TP-Link Web Interface only supports up to 1 user logged in at a time (for security reasons, apparently). So before action you need to authorize and after logout. You can also use with router: (calls authorize() / logout() automatically).

Web Encrypted Password

For Archer C5400X (and firmwares that reject zero-padded RSA login), the plain local password works with TplinkRouterProvider.get_client() or TplinkC1200Router — the client retries with PKCS#1 v1.5 padding like the web UI. You do not need the browser-copied value for that path.

If you got exception - use web encrypted password instead. Check the documentation! or you use TplinkC5400XRouter / TplinkRE813XERouter (RE813XE, RE700X, …) directly, get the web encrypted password by these actions:

  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.

Functions

Not every method is available on every client. Methods below get_ipv6_status that are model-specific (reservations, VPN client, SMS/LTE, …) raise AttributeError / NotImplementedError or are simply missing on unsupported routers.

Function Args Description Return
get_firmware Gets firmware info about the router Firmware
get_status Gets status about the router info including wifi statuses and connected devices info Status
get_ipv4_status Gets WAN and LAN IPv4 status info, gateway, DNS, netmask IPv4Status
get_ipv6_status Gets WAN IPv6 status info, gateway, DNS, site prefix (c6u/SG, MR/EX/VR, C80-style; others raise NotImplementedError) IPv6Status
get_mesh_nodes Gets mesh nodes reported by the main router (EasyMesh on C6U/SG; Deco mesh units including the master). Returns an empty list on routers without mesh; clients that do not implement it raise NotImplementedError [MeshNode]
get_ipv4_reservations Gets IPv4 reserved addresses (static) [IPv4Reservation]
add_ipv4_reservation macaddr: str, ipaddr: str, comment: str = '', enable: bool = True Adds an IPv4 DHCP address reservation (Archer / LuCI clients)
delete_ipv4_reservation macaddr: str Deletes an IPv4 DHCP address reservation (Archer / LuCI clients)
get_ipv4_port_forwards Gets IPv4 port forwarding (virtual server) rules (Archer / LuCI clients) [IPv4PortForward]
add_ipv4_port_forward name: str, external_port: str | int, internal_port: str | int, ipaddr: str, protocol: str = 'TCP', enable: bool = True Adds an IPv4 port forwarding rule; external_port accepts a single port or a start-end range, protocol is TCP/UDP/ALL (Archer / LuCI clients)
update_ipv4_port_forward name: str, new_name: str = None, external_port: str | int = None, internal_port: str | int = None, ipaddr: str = None, protocol: str = None, enable: bool = None Updates an IPv4 port forwarding rule identified by its name (Archer / LuCI clients)
delete_ipv4_port_forward name: str Deletes an IPv4 port forwarding rule by name (Archer / LuCI clients)
get_ipv4_dhcp_leases Gets IPv4 addresses assigned via DHCP [IPv4DHCPLease]
set_ipv4_dhcps enable: bool Turn the LAN IPv4 DHCP server on or off
set_wifi wifi: Connection, enable: bool Turn on/off host, guest, or IoT wifi bands
get_port_modes Whether WAN aggregation, link aggregation and IPTV are on (Archer C5400X) PortModes
nat_boost_status Is NAT Boost (hardware NAT acceleration) on (Archer C5400X); None if the firmware has none. While it is off the Traffic Monitor counts every client's traffic bool, None
get_clients_per_band status: Status = None Clients per band, main and guest networks together (Archer C5400X). Pass a Status from a recent get_status() to avoid an extra poll; otherwise fetches one ClientsPerBand
get_daily_traffic Bytes downloaded and uploaded per day by every client together, as the Traffic Monitor chart shows them (Archer C5400X; answers also while the monitor is off). Includes traffic between local clients DailyTraffic
get_wan_speed Live internet rate from the Network Map, bytes/s (Archer C5400X) WanSpeed
get_speed_test Result of the router's own speed test, Mbit/s (Archer C5400X) SpeedTest
start_speed_test Starts the router's own speed test (Archer C5400X). Loads the WAN for a while — avoid binding to a casual HA button. Call get_speed_test until its status is idle or fail, without logging out in between (like the web page)
get_wan_port_speed Internet port Speed & Duplex value (auto, 1000F, …) and the choices the router offers (Archer C5400X) WanPortSpeed
get_qos Whether QoS is on and the total bandwidth it shares out, Mbit/s (Archer C5400X) QoSSettings
get_firmware_update Installed firmware and, from TP-Link's cloud as the web UI shows it, the newest version and whether it is newer (Archer C5400X). Read only: it never starts the upgrade. Cloud fields stay empty/None without WAN or a TP-Link ID (local-only integrations should treat that as expected) FirmwareUpdate
get_reboot_schedule The scheduled reboot: on/off, time, every day / week / month and which day (Archer C5400X) RebootSchedule
set_reboot_schedule enable: bool, time: str = None, cycle: str = None, day: str = None Turn the scheduled reboot on or off (Archer C5400X); what is not given keeps its current value. The router applies it only when its time comes from the internet
get_router_time The router clock, its time zone, NTP servers and daylight saving time (Archer C5400X) RouterTime
get_system_log How many entries the system log has, per level; never their content, which names clients (Archer C5400X). The list follows the filter chosen on the System Log page SystemLog
traffic_monitor_status Is the Traffic Monitor on (Archer C5400X) bool, None
set_traffic_monitor enable: bool Turn the Traffic Monitor on or off (Archer C5400X)
smart_connect_status Is Smart Connect (one network on every band) on (Archer C5400X) bool, None
set_smart_connect enable: bool Turn Smart Connect on or off (Archer C5400X). Like the router web page, turning it on also gives the 5 GHz bands the 2.4 GHz name, security and password (URL intentionally has two form= params, as the web UI does); turning it off does not bring the old ones back
get_usb_storage USB disks connected and, with a disk, its total, used and free space (Archer C5400X; sizes not yet checked with a disk) UsbStorage
get_usb_sharing Whether Samba, FTP, FTP via internet, Media Sharing and Time Machine are on (Archer C5400X) UsbSharing
print_server_status Is the USB print server on (Archer C5400X; read format taken from the web page, not yet checked) bool, None
get_vpn_server_settings OpenVPN and PPTP server settings without certificates or accounts (Archer C5400X) VpnServerSettings
get_wifi_networks Every WiFi network by form name (wireless_2g, wireless_5g, wireless_5g_2, guest_2g, guest_5g, guest_5g_2), without passwords; networks the router does not have are left out (Archer C5400X) dict[str, WifiNetwork]
wifi_schedule_status Wireless Off Time Schedule: on or off, number of off periods and which bands it has off right now (Archer C5400X) WifiSchedule
set_wifi_schedule enable: bool Turn the Wireless Off Time Schedule on or off, keeping its off periods (Archer C5400X)
set_wifi_off_periods periods: list[WifiOffPeriod] Replace the Wireless Off Time Schedule's off periods (whole hours; does not turn the schedule on or off) (Archer C5400X)
set_wifi_off_period start: int, end: int, days: list[str] Change the first off period, keeping the others; arguments left out keep their value; with no period yet, one starts at 23 -> 7 every day (Archer C5400X)
remove_wifi_off_period Remove the first off period, keeping the others (Archer C5400X)
wps_status Is WPS on (Archer C5400X) bool, None
guest_network_access Whether guests may access each other and the local network (Archer C5400X) GuestNetworkAccess
get_security_settings Remote management, local HTTPS, DMZ, UPnP and its port mappings, port forwards, SPI firewall, ping from WAN/LAN and access control (Archer C5400X). Read only; counts, no client names or MACs. Fields of a page the firmware lacks are None SecuritySettings
get_homecare_status HomeCare antivirus: its three protections, days protected and its database (Archer C5400X) HomeCareStatus
get_blocked_threats How many threats HomeCare blocked, by kind, and the newest one's time, kind and category; never the client, owner, site or attacker (Archer C5400X) BlockedThreats
get_ip_mac_binding Whether IP & MAC Binding is on and how many ARP entries and bindings there are (Archer C5400X) IpMacBinding
reboot reboot router
pppoe_connect Connect PPPoE WAN (XDR/R series only; WAN must be configured for PPPoE)
pppoe_disconnect Disconnect PPPoE WAN (XDR/R series only; WAN must be configured for PPPoE)
set_ewan_connect enable: bool Ethernet WAN up/renew (True) or down/release (False): MR/VR and C6U/LuCI (DHCP WAN only) use DHCP RENEW/RELEASE; C80 uses wan -linkUp / wan -linkDown
authorize authorize for actions
logout logout after all is done
get_vpn_status Gets VPN info for OpenVPN and PPTPVPN and connected clients amount VPNStatus
set_vpn vpn: VPN, enable: bool Turn on/off VPN
get_vpn_client_status Gets VPN client status including enabled state, configured servers, and whitelisted devices VpnClientStatus
set_vpn_client enable: bool Turn VPN client on or off
set_vpn_client_server server_id: str, enable: bool Toggle a VPN server on or off; the router handles deactivating all others when one is enabled
set_vpn_client_device mac: str, enable: bool Enable or disable VPN client access for a device by MAC address
send_sms phone_number: str, message: str Send sms for LTE routers
send_ussd command: str Send USSD command for LTE routers str
get_sms Get sms messages from the first page for LTE routers [SMS]
set_sms_read sms: SMS Set sms message read from the first page for LTE routers
delete_sms sms: SMS Delete sms message from the first page for LTE routers
get_lte_status Get lte info for LTE routers LTEStatus
get_lte_serving_cells Get serving cells info for EX series routers [ServingCell]
get_dsl_status Get DSL line status: sync rates, SNR margin, attenuation (MR/VR; also inherited by EX/VR1200v, EX DSL path untested on hardware; empty DSLStatus when there is no active DSL line) DSLStatus
get_repeater_status Get the wireless backhaul of a range extender in repeater mode: upstream RSSI, PHY rates, BSSID/SSID, internet and mesh state (RE813XE family; forms the firmware does not have are skipped) RepeaterStatus
get_wifi wifi: Connection Get wifi info WifiStatus
backup_config Download router settings backup as bytes (VR1200v only; call authorize() first) bytes
get_port_status Per-port link, speed, flow control, LAG and packet counters (TL-SG108E; call authorize() first) → PortStatus. Archer C5400X: link, speed and duplex of the Internet port (port 0) and LAN 1-8 → RouterPortStatus PortStatus / RouterPortStatus

Dataclass

Firmware

Field Description Type
hardware_version Returns like - Archer C6U str
model Returns like - Archer C6U v1.0 str
firmware_version Returns like - 1.1.3 Build 3425243 str

Status

Field Description Type
wan_macaddr router wan mac address str, None
wan_macaddress router wan mac address macaddress.EUI48, None
lan_macaddr router lan mac address str, None
lan_macaddress router lan mac address macaddress.EUI48, None
wan_ipv4_addr router wan ipv4 address str, None
wan_ipv4_address router wan ipv4 address ipaddress.IPv4Address, None
lan_ipv4_addr router lan ipv4 address str, None
lan_ipv4_address router lan ipv4 address ipaddress.IPv4Address, None
wan_ipv4_gateway router wan ipv4 gateway str, None
wan_ipv4_gateway_address router wan ipv4 gateway address ipaddress.IPv4Address, None
wan_ipv6_enabled Is WAN IPv6 enabled bool, None
wan_ipv6_addr router wan ipv6 address str, None
ewan_connected Is Ethernet WAN connected (None if no eth WAN / not reported; MR/VR/C80; C6U/LuCI when WAN is DHCP) bool, None
lan_ipv4_dhcp_enable Is LAN IPv4 DHCP server enabled bool, None
wired_total Total amount of wired clients int
wifi_clients_total Total amount of host wifi clients int
guest_clients_total Total amount of guest wifi clients int
clients_total Total amount of all connected clients int
iot_clients_total Total amount of all iot connected clients int, None
guest_2g_enable Is guest wifi 2.4G enabled bool, None
guest_5g_enable Is guest wifi 5G enabled bool, None
guest_5g_2_enable Is guest wifi on the second 5G band enabled (tri-band) bool, None
guest_6g_enable Is guest wifi 6G enabled bool, None
iot_2g_enable Is IoT wifi 2.4G enabled bool, None
iot_5g_enable Is IoT wifi 5G enabled bool, None
iot_6g_enable Is IoT wifi 6G enabled bool, None
wifi_2g_enable Is host wifi 2.4G enabled bool, None
wifi_5g_enable Is host wifi 5G enabled bool, None
wifi_5g_2_enable Is host wifi on the second 5G band enabled (tri-band) bool, None
wifi_6g_enable Is host wifi 6G enabled bool, None
wifi_mlo_2g_enable Is MLO enabled on 2.4G (EX / C6U-SG when mlo_host_2g_enable is present) bool, None
wifi_mlo_5g_enable Is MLO enabled on 5G (EX / C6U-SG when mlo_host_5g_enable is present) bool, None
wifi_mlo_6g_enable Is MLO enabled on 6G (EX / C6U-SG when mlo_host_6g_enable is present) bool, None
wan_ipv4_uptime Internet Uptime int, None
mem_usage Memory usage in percentage between 0 and 1 float, None
cpu_usage CPU usage in percentage between 0 and 1 float, None
conn_type Connection type str, None
clients_down_speed What current devices receive, bytes/s (Archer C5400X, Traffic Monitor list; orphan/stale MAC rows are ignored). Includes traffic between local clients, so it is not exactly the internet speed int, None
clients_up_speed What current devices send, bytes/s, counted the same way as clients_down_speed int, None
devices List of all connected devices list[Device]

Device

Field Description Type
type client connection type (2.4G or 5G, guest wifi or host wifi, wired) Connection
macaddr client mac address str
macaddress client mac address macaddress
ipaddr client ip address str
ipaddress client ip address ipaddress
hostname client hostname str
packets_sent total packets sent int, None
packets_received total packets received int, None
down_speed download / receive speed (Archer C5400X: bytes/s from Traffic Monitor; RE813XE family: currently the same PHY Mbps as rx_rate, for compatibility) int, None
up_speed upload / transmit speed (Archer C5400X: bytes/s from Traffic Monitor; RE813XE family: currently the same PHY Mbps as tx_rate, for compatibility) int, None
tx_rate transmit rate (Mbps) int, None
rx_rate receive rate (Mbps) int, None
online_time client online time (seconds) float, None
traffic_usage total traffic usage (bytes) int, None
signal Signal strength int, None
active Is active device bool
ap_name ap_name str
ssid ssid str
frequency frequency str

MeshNode

One node of a mesh network as reported by the main router. Families populate different subsets of fields; values absent from the router's answer stay None.

EasyMesh (C6U / SG). The node whose role is main_router is the router itself; every other node is a satellite whose parent_macaddr points at the node it uplinks through - that parent may be another satellite in a multi-hop mesh. The main router reports no uplink; the bar level / support_reboot are only sent by newer firmware (seen on BE series, absent on AX series). signal_level is a firmware-dependent bar level (not dBm): observed as 1–3 on BE and up to 5 on AX.

Deco. Roles are master / slave (is_main_router accepts both vocabularies). Backhaul quality is per-band dBm in signal_2g / signal_5g (plus rx/tx rates); connection state is in group_status and is also copied to shared status so callers that only read status work across families. internet_status, hardware/firmware versions and wired_ports are Deco-only.

Field Description Type
macaddr node mac address str, None
macaddress node mac address macaddress.EUI48, None
ipaddr node ip address str, None
ipaddress node ip address ipaddress.IPv4Address, None
parent_macaddr mac address of the node this one uplinks through str, None
parent_macaddress mac address of the node this one uplinks through macaddress.EUI48, None
is_main_router True when role is main_router (EasyMesh) or master (Deco) bool
name node name str, None
model node model, like - Archer AX55 / X50 str, None
role EasyMesh: main_router / satellite_router; Deco: master / slave str, None
status node status, like - connected (on Deco, mirrors group_status) str, None
device_type node type, like - WirelessRouter, RangeExtender str, None
vendor node vendor str, None
location node location as set in the router UI str, None
connect_type uplink type - wire or wireless str, None
mesh_type mesh flavour, like - easymesh str, None
client_num amount of clients connected to this node int, None
signal_level EasyMesh uplink quality as a firmware-dependent bar level (not dBm) int, None
support_reboot Can this node be rebooted from the main router (EasyMesh) bool, None
hardware_version Deco hardware version str, None
firmware_version Deco firmware version string str, None
internet_status Deco internet reachability, like - online str, None
group_status Deco mesh group state; same value as status str, None
signal_2g / signal_5g Deco backhaul RSSI in dBm int, None
rx_rate_2g / rx_rate_5g Deco backhaul RX rate int, None
tx_rate_2g / tx_rate_5g Deco backhaul TX rate int, None
wired_ports Deco wired port count int, None

IPv4Reservation

Field Description Type
macaddr client mac address str
macaddress client mac address macaddress
ipaddr client ip address str
ipaddress client ip address ipaddress
hostname client hostname str
enabled enabled bool

IPv4DHCPLease

Field Description Type
macaddr client mac address str
macaddress client mac address macaddress
ipaddr client ip address str
ipaddress client ip address ipaddress
hostname client hostname str
lease_time ip address lease time str

IPv4PortForward

Field Description Type
name rule name (unique per router, used as the rule identifier) str
ipaddr internal (LAN) ip address the ports forward to str
ipaddress internal ip address ipaddress
external_port WAN-side port, single (443) or range (8000-9000) str
internal_port LAN-side port str
protocol TCP, UDP or ALL str
enabled rule enabled bool

IPv4Status

Field Description Type
wan_macaddr router WAN mac address str, None
wan_macaddress router WAN mac address macaddress.EUI48, None
wan_ipv4_ipaddr router WAN IPv4 address str, None
wan_ipv4_ipaddress router WAN IPv4 address ipaddress.IPv4Address, None
wan_ipv4_gateway router WAN gateway IP address str, None
wan_ipv4_gateway_address router WAN gateway IP address ipaddress.IPv4Address, None
wan_ipv4_conntype router connection type str
wan_ipv4_netmask router WAN IP netmask str, None
wan_ipv4_netmask_address router WAN IP netmask ipaddress.IPv4Address, None
wan_ipv4_pridns router primary dns server str, None
wan_ipv4_pridns_address router primary dns server ipaddress.IPv4Address, None
wan_ipv4_snddns router secondary dns server str, None
wan_ipv4_snddns_address router secondary dns server ipaddress.IPv4Address, None
lan_macaddr router LAN mac address str, None
lan_macaddress router LAN mac address macaddress.EUI48, None
lan_ipv4_ipaddr router LAN IP address str, None
lan_ipv4_ipaddress router LAN IP address ipaddress.IPv4Address, None
lan_ipv4_dhcp_enable router LAN DHCP enabled bool
lan_ipv4_netmask router LAN IP netmask str, None
lan_ipv4_netmask_address router LAN IP netmask ipaddress.IPv4Address, None
remote router remote bool, None

IPv6Status

Field Description Type
wan_ipv6_enabled Is WAN IPv6 enabled bool, None
wan_ipv6_conn_status WAN IPv6 connection status (e.g. Connected, Disabled) str, None
wan_ipv6_conntype WAN IPv6 connection type str, None
wan_ipv6_addr_type WAN IPv6 address acquisition type (e.g. DHCPv6) str, None
wan_ipv6_addr router WAN IPv6 address str, None
wan_ipv6_gateway router WAN IPv6 gateway str, None
wan_ipv6_pridns router primary IPv6 DNS server (unlike IPv4, returns address object, not str) ipaddress.IPv6Address, None
wan_ipv6_snddns router secondary IPv6 DNS server (unlike IPv4, returns address object, not str) ipaddress.IPv6Address, None
ipv6_site_prefix IPv6 site prefix str, None
ipv6_site_prefix_length IPv6 site prefix length str, None

Not all fields are filled by every client:

  • c6u / SG / C5400X / C1200: wan_ipv6_enabled, wan_ipv6_conntype, wan_ipv6_addr, wan_ipv6_gateway, wan_ipv6_pridns, wan_ipv6_snddns, wan_ipv6_conn_status, ipv6_site_prefix
  • MR / EX / VR / MR200 / C50 / WR841 / C3200: wan_ipv6_enabled, wan_ipv6_conn_status, wan_ipv6_addr_type, wan_ipv6_conntype, wan_ipv6_addr, wan_ipv6_gateway, wan_ipv6_pridns, wan_ipv6_snddns, ipv6_site_prefix, ipv6_site_prefix_length
  • C80: wan_ipv6_enabled, wan_ipv6_conn_status, wan_ipv6_addr_type, wan_ipv6_addr, wan_ipv6_gateway, wan_ipv6_pridns, wan_ipv6_snddns, ipv6_site_prefix, ipv6_site_prefix_length

VPNStatus

Field Description Type
openvpn_enable OpenVPN is enabled bool
pptpvpn_enable PPTPVPN is enabled bool
ipsecvpn_enable IPSEC is enabled bool
openvpn_clients_total OpenVPN clients connected int
pptpvpn_clients_total PPTPVPN clients connected int

VpnClientStatus

Field Description Type
enabled VPN client is enabled bool
servers Configured VPN client servers [VpnClientServer]
devices Devices in the VPN client whitelist [VpnClientDevice]

VpnClientServer

Field Description Type
id Server identifier str
name Server display name str
protocol VPN protocol VpnClientServerProtocol
active Is this server currently active bool
status Connection status string from router (e.g. "connected") str, None

VpnClientDevice

Field Description Type
macaddr device mac address str
macaddress device mac address EUI48
name device hostname str
enabled Is device routed through VPN client bool

SMS

Field Description Type
id message index int
sender sender str
content sms text str
received_at received datetime datetime
unread is message unread bool

LTEStatus

Field Description Type
enable is enabled int
connect_status connect status int
network_type network type int
network_type_info Example: 4G LTE str
sim_status sim status int
sim_status_info Example: SIM locked. str
total_statistics total statistics in bytes int
cur_rx_speed current download speed in bytes per second int
cur_tx_speed current upload speed in bytes per second int
sms_unread_count sms unread amount int
sig_level signal level int
rsrp RSRP int
rsrq RSRQ int
snr SNR int
isp_name ISP name str
network_types All possible network types - {0: "No Service", 1: "GSM", 2: "WCDMA", 3: "4G LTE", 4: "TD-SCDMA", 5: "CDMA 1x", 6: "CDMA 1x Ev-Do", 7: "4G+ LTE", 8: "5G NR"} dict
sim_statuses All possible sim statuses - {0: "No SIM card detected or SIM card error.", 1: "No SIM card detected.", 2: "SIM card error.", 3: "SIM card prepared.", 4: "SIM locked.", 5: "SIM unlocked. Authentication succeeded.", 6: "PIN locked.", 7: "SIM card is locked permanently.", 8: "suspension of transmission", 9: "Unopened"} dict

DSLStatus

Field Description Type
status DSL line status as reported by the device. Example: Up str, None
is_up is the line up bool
modulation Example: VDSL2 str, None
annex Example: Annex auto str, None
upstream_curr_rate current upstream sync rate in kbps int, None
downstream_curr_rate current downstream sync rate in kbps int, None
upstream_max_rate maximum attainable upstream rate in kbps int, None
downstream_max_rate maximum attainable downstream rate in kbps int, None
upstream_noise_margin upstream SNR margin in dB float, None
downstream_noise_margin downstream SNR margin in dB float, None
upstream_attenuation upstream line attenuation in dB float, None
downstream_attenuation downstream line attenuation in dB float, None
uptime line uptime as reported by the device (X_TP_UpTime) int, None

ServingCell

Field Description Type
network_type network type int
band band number int
arfcn absolute radio frequency channel number int
downlink_bandwidth MHz int
downlink_frequency MHz int
downlink_modulation Downlink modulation scheme str
uplink_modulation Uplink modulation scheme str
cqi Channel quality indicator int
ri Rank indicator int
resource_blocks Number of resource blocks allocated in the NR cell int
rsrp dBm int
rsrq dBm int

RepeaterStatus

Field Description Type
connection_2g / connection_5g backhaul connection state per band as reported by the extender. Example: connected str, None
connected_2g / connected_5g is the backhaul on this band connected; False also when the state is unknown (connection_* is None) bool
internet_status internet state as reported by the extender. Example: connected str, None
ipconn_status IP connection state as reported by the extender. Example: connected str, None
ssid_2g / ssid_5g SSID of the upstream access point str, None
bssid_2g / bssid_5g MAC address of the upstream access point radio str, None
bssid_2g_macaddress / bssid_5g_macaddress MAC address of the upstream access point radio macaddress.EUI48, None
rssi_2g / rssi_5g signal of the upstream access point in dBm; None unless connected_* is True int, None
rx_rate_2g / rx_rate_5g backhaul receive PHY rate in Mbps (not throughput); None unless connected_* is True int, None
tx_rate_2g / tx_rate_5g backhaul transmit PHY rate in Mbps (not throughput); None unless connected_* is True int, None
mesh_enable is mesh enabled on the extender bool, None
mesh_sync_status mesh sync state, raw firmware value. Kept separate from mesh_enable: mesh can be enabled but not synced str, None

WifiStatus

Field Description Type
enable enable bool
ssid ssid str
hidden hidden bool
encryption encryption str
psk_key psk_key str
portal_enable portal_enable bool
portal_password portal_password str
channel channel int

PortStatus

Field Description Type
port Physical port number (1-based) int
enabled Port administratively enabled bool, None
link_up Link is up bool, None
auto_negotiation Auto-negotiation configured bool, None
configured_speed Configured speed in Mbps (fixed mode) int, None
configured_duplex Configured duplex (half / full) str, None
negotiated_speed Negotiated speed in Mbps int, None
negotiated_duplex Negotiated duplex (half / full) str, None
flow_control_enabled Flow control configured bool, None
flow_control_active Flow control active bool, None
lag LAG group number, if any int, None
tx_good_packets Transmitted good packets (not bytes; may reset) int, None
tx_bad_packets Transmitted bad packets int, None
rx_good_packets Received good packets int, None
rx_bad_packets Received bad packets int, None

RouterPortStatus

Link state of a router Internet/LAN port (Archer C5400X Network Map). Separate from switch PortStatus (no admin enable, flow control, LAG or counters).

Field Description Type
port Port number (0 = Internet, then LAN 1–8) int
link_up Link is up bool, None
negotiated_speed Negotiated speed in Mbps int, None
negotiated_duplex Negotiated duplex (half / full) str, None

PortModes

Field Description Type
wan_aggregation A LAN port works as a second WAN port bool, None
link_aggregation Two LAN ports are aggregated bool, None
iptv IPTV/VLAN port setup is on bool, None

UsbStorage

Field Description Type
disks USB disks connected int, None
capacity Total size of every volume, in bytes (K/M/G/T read as powers of 1000, like the web page) int, None
used Used space, in bytes int, None
free Free space, in bytes int, None

UsbSharing

Field Description Type
samba Samba (Network Neighborhood) sharing is on bool, None
ftp FTP server is on bool, None
ftp_internet FTP via internet is on bool, None
media_sharing Media Sharing (DLNA) is on bool, None
time_machine Time Machine backups are on bool, None

VpnServerSettings

Field Description Type
openvpn_enabled OpenVPN server is on bool, None
openvpn_protocol OpenVPN service type (udp / tcp) str, None
openvpn_port OpenVPN service port int, None
openvpn_access What OpenVPN clients reach (home = home network only, internet = internet and home network) str, None
pptp_enabled PPTP server is on bool, None
pptp_unencrypted_access PPTP allows unencrypted connections bool, None
pptp_samba_access PPTP clients may reach Samba (Network Place) bool, None

ClientsPerBand

Field Description Type
wired Wired clients int, None
wifi_2g Clients on 2.4 GHz (main and guest networks) int, None
wifi_5g Clients on 5 GHz (the first 5 GHz band on tri-band routers) int, None
wifi_5g_2 Clients on the second 5 GHz band; None on routers without it int, None

DailyTraffic

Field Description Type
downloads Bytes downloaded per day, newest first (index 0 = today); up to 7 days list[int, None]
uploads Bytes uploaded per day, same order list[int, None]
download_today downloads[0] int, None
upload_today uploads[0] int, None

WifiNetwork

Guest networks only fill enable, ssid, hidden and encryption. There is no password field.

Field Description Type
enable The network is on bool, None
ssid Network name str, None
hidden The name is hidden bool, None
encryption Security: psk, none… str, None
channel Configured channel: auto or a number str, None
current_channel Channel in use int, None
hwmode Wireless mode, e.g. bgn, anac_5 str, None
htmode Channel width, e.g. auto, 20, 40, 80 str, None
txpower Transmit power: low, middle, high str, None
airtime_fairness Airtime Fairness is on bool, None
mu_mimo MU-MIMO is on bool, None

WifiSchedule

Field Description Type
enable The Wireless Off Time Schedule is on bool, None
off_periods Number of off periods in the schedule int, None
off_now_2g The schedule has the 2.4 GHz band off right now bool, None
off_now_5g The schedule has the 5 GHz band off right now bool, None
off_now_5g_2 The schedule has the second 5 GHz band off right now bool, None
periods The off periods, in the router's order list[WifiOffPeriod], None

WifiOffPeriod

Field Description Type
start Hour the WiFi goes off, 0-24 int
end Hour it comes back, 0-24; before start means overnight int
days Router day names (sun .. sat); empty = every day list[str]

GuestNetworkAccess

Field Description Type
each_other Guests may access each other bool, None
local_network Guests may access the local network bool, None

WanSpeed

Field Description Type
download Internet download rate, bytes/s int, None
upload Internet upload rate, bytes/s int, None
time When the router took the sample datetime, None

SpeedTest

Field Description Type
status idle, down_test, up_test or fail str, None
download Download speed, Mbit/s (None while measuring or if it never ran) float, None
upload Upload speed, Mbit/s float, None
time When the test ran (None if never) datetime, None

WanPortSpeed

Field Description Type
value Value as the router gives it, e.g. auto, 1000F, 100F str, None
speed Speed in Mbps from the value (None for auto) int, None
duplex full / half from the value str, None
auto_negotiation The value is auto bool, None
supported Values the router offers list[str]

QoSSettings

Field Description Type
enabled QoS is on bool, None
mode QoS mode, e.g. custom str, None
bandwidth_mode auto (from the last speed test) or manual str, None
download_bandwidth Total download bandwidth, Mbit/s float, None
upload_bandwidth Total upload bandwidth, Mbit/s float, None

SecuritySettings

Field Description Type
remote_management Remote management (web access from the internet) is on bool, None
remote_management_any_address Remote management is allowed from any address (not only a specified one) bool, None
remote_management_http_port Remote management HTTP port int, None
remote_management_https_port Remote management HTTPS port int, None
local_https Local management over HTTPS is on bool, None
dmz DMZ is on bool, None
dmz_host DMZ host IP address, only while the DMZ is on str, None
upnp UPnP is on bool, None
upnp_mappings Port mappings opened through UPnP int, None
upnp_mappings_by_protocol UPnP port mappings per protocol, e.g. {'UDP': 3, 'TCP': 1} dict, None
port_forwards Port forwarding (virtual server) rules int, None
port_forwards_enabled Port forwarding rules that are on int, None
spi_firewall SPI firewall is on bool, None
ping_from_wan The router answers pings from the internet bool, None
ping_from_lan The router answers pings from the LAN bool, None
access_control Access control is on bool, None
access_control_mode blacklist or whitelist str, None
access_control_blocked Devices in the access control block list (blacklist mode only) int, None

HomeCareStatus

Field Description Type
malicious_content_filter Malicious content filter is on bool, None
intrusion_prevention Intrusion prevention system is on bool, None
infected_device_quarantine Infected device quarantine is on bool, None
protected_days Days the antivirus has been protecting the network int, None
database_checked When the antivirus database was last found up to date (UTC) datetime, None
database_updating The antivirus database is updating bool, None
rules_version Version of the antivirus rule list int, None

BlockedThreats

Field Description Type
events Entries in the blocked threats history int
hits Times those threats were blocked int
by_type Entries per kind: block (malicious site), prevent (intrusion), infected_block (infected device) dict
last_time Time of the newest entry (UTC) datetime, None
last_type Kind of the newest entry str, None
last_category_id Category id of the newest entry (see admin/security?form=category) int, None

IpMacBinding

Field Description Type
enable IP & MAC Binding is on bool, None
arp_entries Entries in the ARP list int, None
bindings IP & MAC bindings int, None

FirmwareUpdate

Field Description Type
installed_version Returns like - 1.2.1 Build 20250928 rel.12879(5553) str, None
latest_version Newest version TP-Link's cloud has for the router; the installed one when it is up to date str, None
update_available The newest version is not the installed one bool, None
release_notes What the newest version changes str, None

RebootSchedule

Field Description Type
enable The scheduled reboot is on bool, None
time Router time of the reboot, like 03:00 str, None
cycle day, week or month str, None
day Mon ... Sun when weekly, 1 ... 28 when monthly str, None

RouterTime

Field Description Type
time Router clock, in its own time zone (naive) datetime, None
read_at This computer's clock (UTC) when the router clock was read, to measure its offset datetime, None
automatic The time comes from the NTP servers (not set by hand or from a browser) bool, None
timezone Router time zone code, like 20 str, None
ntp_servers NTP servers list[str]
dst_enable Daylight saving time is on bool, None
dst_active Daylight saving time applies now bool, None
dst_start When it starts, like 2nd Sun Mar 2am str, None
dst_end When it ends, like 1st Sun Nov 2am str, None

SystemLog

Field Description Type
entries Entries in the system log int, None
levels Entries per level (lower case), like {"info": 140, "warning": 3} dict[str, int]

Enum

Connection

  • Connection.HOST_2G - host wifi 2.4G
  • Connection.HOST_5G - host wifi 5G
  • Connection.HOST_5G_2 - host wifi second 5G band (tri-band C5400X set_wifi and its clients)
  • Connection.HOST_6G - host wifi 6G
  • Connection.HOST_MLO - host MLO client connection (EX; multi-link)
  • Connection.HOST_MLO_2G - MLO enable switch for 2.4G (EX set_wifi only)
  • Connection.HOST_MLO_5G - MLO enable switch for 5G (EX set_wifi only)
  • Connection.HOST_MLO_6G - MLO enable switch for 6G (EX set_wifi only)
  • Connection.GUEST_2G - guest wifi 2.4G
  • Connection.GUEST_5G - guest wifi 5G
  • Connection.GUEST_5G_2 - guest wifi second 5G band (tri-band C5400X set_wifi and its clients)
  • Connection.GUEST_6G - guest wifi 6G
  • Connection.IOT_2G - IoT wifi 2.4G
  • Connection.IOT_5G - IoT wifi 5G
  • Connection.IOT_6G - IoT wifi 6G
  • Connection.WIRED - Wired
  • Connection.UNKNOWN - Unknown connection type

VPN

  • VPN.OPEN_VPN
  • VPN.PPTP_VPN
  • VPN.IPSEC

VpnClientServerProtocol

  • VpnClientServerProtocol.OPEN_VPN
  • VpnClientServerProtocol.PPTP
  • VpnClientServerProtocol.L2TP_IPSEC

Supported routers

  • Archer A10 v1
  • Archer A20 v1.0
  • Archer A6 (2.0, 4.0)
  • Archer A7 V5
  • Archer A8 (1.0, 2.20)
  • Archer A9 V6
  • Archer AX10 v1.0
  • Archer AX11000 V1
  • Archer AX12 v1.0
  • Archer AX17 v1.0
  • Archer AX1800
  • Archer AX20 (v1.0, v3.0)
  • Archer AX21 (v1.20, v3.0, v4.6)
  • Archer AX23 (v1.0, v1.2)
  • Archer AX3000 V1
  • Archer AX50 v1.0
  • Archer AX53 (v1.0, v2)
  • Archer AX55 (v1.0, V1.60, v4.0)
  • Archer AX55 Pro v1.0
  • Archer AX58 v1.0
  • Archer AX6000 V1
  • Archer AX72 V1
  • Archer AX73 (V1, V2.0)
  • Archer AX75 V1
  • Archer AX90 V1.20
  • Archer AX95 v1.0
  • Archer AXE16000
  • Archer AXE5400 v1.0
  • Archer AXE75 V1
  • Archer BE220 v1.0
  • Archer BE230 (v1.0, v2.0)
  • Archer BE3600 (v1.0, v1.2, v1.6)
  • Archer BE400 v1.0
  • Archer BE450 v1.0
  • Archer BE550 (v1.0, V2)
  • Archer BE800 v1.0
  • Archer BE805 (v1.0, v1.20)
  • Archer C1200 (v1.0, v2.0)
  • Archer C2300 (v1.0, v2.0)
  • Archer C24 (1.0, 2.0)
  • Archer C3200 v1
  • Archer C5400X V1
  • Archer C6 (v2.0, v3.0, v3.20, 4.0)
  • Archer C50 v4
  • Archer C60 v2.0
  • Archer C64 1.0
  • Archer C6U v1.0
  • Archer C7 (v4.0, v5.0)
  • Archer C80 (1.0, 2.20)
  • Archer GE800 v1.0
  • Archer GX90 v1.0
  • Archer MR200 (v2, v5, v5.3, v6.0)
  • Archer MR400 V.4.3
  • Archer MR550 v1
  • Archer MR600 (v1, v2, v3)
  • Archer NX200 (v1.0, v2.0)
  • Archer VR1200v (v1, v2)
  • Archer VR1600v v1
  • Archer VR2100v v1
  • Archer VR2800 v1
  • Archer VR400 (v2, v3)
  • Archer VR600 v3
  • Archer VR900v
  • Archer VX1800v v1.0
  • Archer VX231v v1.0
  • BE11000 2.0
  • CPE210 v2.0
  • CPE220 v3.0
  • Deco BE25 1.0
  • Deco E4R 4.0
  • Deco M4 2.0
  • Deco M4R 2.0
  • Deco M5 v3
  • Deco M9 Plus 1.0
  • Deco M9 Pro
  • Deco P7
  • Deco X20
  • Deco X50 v1.3
  • Deco X50-5G (1.20, 2.0)
  • Deco X55 1.0
  • Deco X60 V3
  • Deco X90
  • Deco XE75 (v1.0, v2.0)
  • Deco XE75PRO (v3.0)
  • EAP115 v2.0
  • EX220-G2u v1
  • EX511 v2.0
  • EX920 v1.0
  • HB810 v2.6
  • HX510 v1.0
  • M8550 v1
  • NE200-Outdoor v1.0
  • NE211-Outdoor v1.0
  • NX510v v1.0
  • NX600 v2.0
  • RE305 4.0
  • RE315 1.0
  • RE330 v1
  • RE505X v1.0
  • RE700X
  • RE813XE v1.6
  • TD-W9960 (v1, V1.20)
  • TL-7DR6430 1.0
  • TL-7DR7270 1.0 (firmware 1.0.18+, new auth)
  • TL-MR100 (v2.0, v3.0)
  • TL-MR100-Outdoor v1.0
  • TL-MR105
  • TL-MR110-Outdoor v1.0
  • TL-MR150 v2
  • TL-MR6400 (v5, v5.3, v7)
  • TL-MR6500v
  • TL-R470GP-AC (4.0, 6.0)
  • TL-R488GPM-AC 2.0
  • TL-SG108E v6.0
  • TL-WA1201 3.0
  • TL-WA3001 v1.0
  • TL-WR841N v14
  • TL-WR844N v1.0
  • TL-WR3002X v1.0
  • TL-WDR3600 V1
  • TL-XDR3010 V2
  • TL-XDR5410 1.0
  • TL-XDR6010
  • TL-XDR6088 v1.0.30
  • VX420-G2h v1.1
  • VX800v v1
  • XC220-G3v v2.30
  • XGB834v v1.1

MERCUSYS routers

  • AC10 1.20
  • Halo H25BE 1.0
  • Halo H3000x 1.0
  • Halo H47BE 2.0
  • Halo H60XR 1.0
  • Halo H80X 1.0
  • MB118-4G v1.0
  • ME30 1.0
  • MR47BE v1.0
  • MR50G 1.0
  • MR60X 2.0
  • MR80X v2.0

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

Adding Support For More Models

Guidelines CONTRIBUTING.md

Local Development

  • Download this repository.
  • Run pip install -e path/to/repo.
  • Make changes to files within the tplinkrouterc6u directory.
  • Exercise the changes following the "Usage" section above.

The sanity check test.py illustrates a few tests and runs through a list of queries in queries.txt creating logs of the results of each query in the logs folder. This can be used to capture the dictionary output of all cgi-bin form submissions.

Run tests

  • Run python -m unittest discover ./test

Thanks To

Metadata

Release files for tplinkrouterc6u 5.39.0

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

Source distribution (sdist)

Source distribution for tplinkrouterc6u 5.39.0
File Size Uploaded Provenance Actions
tplinkrouterc6u-5.39.0.tar.gz 280.0 kB Without provenance Details for tplinkrouterc6u-5.39.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tplinkrouterc6u 5.39.0
File Interpreter ABI Platform Actions
tplinkrouterc6u-5.39.0-py3-none-any.whl Python 3 none any Details for tplinkrouterc6u-5.39.0-py3-none-any.whl

Total release size: 559.1 kB

Release files / tplinkrouterc6u-5.39.0.tar.gz

Download URL tplinkrouterc6u-5.39.0.tar.gz
Size 280.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bda08726cbd37d75e3e9b6c2b2553f94d236fdeb0506e8ea00d65ddbf11865c6
BLAKE2b-256 checksum
How to use checksums
60796701b7f3640b816aaf7d8bac7e1224f41e9b1f325983f2d7540a3d60a99e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / tplinkrouterc6u-5.39.0-py3-none-any.whl

Download URL tplinkrouterc6u-5.39.0-py3-none-any.whl
Size 279.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8e2d091e22e60ab67450142d5b1f6b5ee3434d7597623ff8ffd4fe9cc174e7d
BLAKE2b-256 checksum
How to use checksums
6dbc9ac1833d64f45621920eec67248f7e1f86f7650308d512db36feb74f5b26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for tplinkrouterc6u 5.39.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

5.39.0 This release

2 release files No provenance

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