Skip to main content

Tenda 4G09 Python Client

A lightweight Python library for interacting with the Tenda 4G09 LTE router through its web interface.

Features

  • Router authentication and session management
  • Retrieving router status and Wi-Fi information
  • Reading SIM and WAN configuration
  • Detecting whether the mobile WAN connection is active
  • Requesting a mobile WAN reconnection
  • Retrieving serving cell information from the modem

Requirements

  • Python 3.10+
  • Tenda 4G09 router accessible over the local network

Installation

Install:

pip install tenda-4g09-client

Quick start

Collecting basic information.

from tenda_4g09 import Tenda4G09


URL = "192.168.0.1"

with Tenda4G09(URL, password="your-password") as router:
    status = router.get_status()

    print(f"Router IP:          {status.lan_ip}")
    print(f"Connected clients:  {status.client_count}")
    print(f"Work mode:          {status.work_mode}")
    print(f"Device name:        {status.device_name}\n")

    [print(f"{client}\n") for client in router.get_online_clients()]

output:

Router IP:          192.168.0.1
Connected clients:  3
Work mode:          3G/4G
Device name:        4G09

Client: RE605X (192.168.0.2)
  Device ID: ee:d3:##:##:##:29
  Upload: 8.05 kB/s
  Download: 30.63 kB/s
  Blocked: No
  Guest: No

Client: homeassistant (192.168.0.4)
  Device ID: b8:27:##:##:##:0a
  Upload: 0.00 kB/s
  Download: 0.00 kB/s
  Blocked: No
  Guest: No

Client: DESKTOP-AT2M0OR (192.168.0.49)
  Device ID: 34:6f:##:##:##:ef
  Upload: 27.26 kB/s
  Download: 403.56 kB/s
  Blocked: No
  Guest: No

Replace the IP address and password with your router's settings.

The mobile WAN reconnect

Check whether the router has lost its mobile WAN connection and try to reconnect.

with Tenda4G09(URL, password) as router:

    print(f"Before:\n\tMobile data connected: {router.is_mobile_data_connected()}\n")

    if not router.is_mobile_data_connected():
        router.mobile_data_connect()

    time.sleep(2)

    print(f"After:\n\tMobile data connected: {router.is_mobile_data_connected()}")

output:

Before:
        Mobile data connected: False

After:
        Mobile data connected: True

Getting the signal information from the modem

Retrieve the parameters of the serving cell connection (equivalent AT command: AT+QENG="servingcell").

with Tenda4G09(URL, password) as router:
    client = router.get_telnet_client(router.host_ip)
    print(client.get_signal_info())

output:

========== LTE SERVING CELL ==========
Connection state : NOCONN
Technology       : LTE (FDD)
MCC / MNC        : 260 / 02
Cell ID          : 0x###2512 (HEX), ###67602 (DEC)
PCI              : 334
TAC              : 0x##af (HEX), ##911 (DEC)
LTE band         : B20
EARFCN           : 6375
UL bandwidth     : 15 MHz
DL bandwidth     : 15 MHz
--------------------------------------
RSRP             : -105 dBm
RSRQ             :  -13 dB
RSSI             :  -72 dBm
SINR             : 11.0 dB
CQI              : 255
TX power         : 170 (raw value)
SRXLEV           : -
======================================

Compatibility

Designed for the Tenda 4G09 router. Compatibility with other models and firmware versions has not been verified.

Security

Use the library only on trusted networks. Do not commit router credentials to your repository.

License

MIT — see the LICENSE file.

Metadata

Release files for tenda-4g09-client 0.3.7

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

Source distribution (sdist)

Source distribution for tenda-4g09-client 0.3.7
File Size Uploaded Provenance Actions
tenda_4g09_client-0.3.7.tar.gz 17.6 kB Without provenance Details for tenda_4g09_client-0.3.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tenda-4g09-client 0.3.7
File Interpreter ABI Platform Actions
tenda_4g09_client-0.3.7-py3-none-any.whl Python 3 none any Details for tenda_4g09_client-0.3.7-py3-none-any.whl

Total release size: 39.0 kB

Release files / tenda_4g09_client-0.3.7.tar.gz

Download URL tenda_4g09_client-0.3.7.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7ae8bbdb267c3c17bfe14a266bc2ebeaf6b567c8ee2c953df90b2a7bdfab5e9b
BLAKE2b-256 checksum
How to use checksums
5d90720d32883381d8574283ea3e874d1f61a4af6a15ce5fc2028d0e391e6225
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / tenda_4g09_client-0.3.7-py3-none-any.whl

Download URL tenda_4g09_client-0.3.7-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fb3b84b706d4572457428709b97a5d9fed956b5c283ced8b484f2b5f1ab591d
BLAKE2b-256 checksum
How to use checksums
a2116d07a4e5bd482bf7ccab03d671d2e61b26f3cba4ea605386e24a2f1ca3c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for tenda-4g09-client 0.3.7

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.

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