Skip to main content

API wrapper for communication with ASUSWRT-powered routers

Project description

GitHub Release License

AsusRouter

AsusRouter is an API wrapper for communication with ASUSWRT-powered routers using HTTP(S) protocols. This version is not final yet and has some issues. Please, consider them.

Features

  • Monitoring data: CPU/RAM usage, Tx and Rx traffic and speed for different interfaces (WAN, USB, dual-WAN support, local interfaces), WAN/LAN ports status (speed of devices), NVRAM, connected devices (LAN/WLAN) and other.
  • Sending commands to the device when enable_control is set to True (default is False).
  • SSL server certificates on the device side (including certificate check on the connection from Trusted Root Certificates or your own specified certificate file).

Installation

Installation of the latest release is available from PyPI:

pip install asusrouter

Usage

Once installed, you can import the AsusRouter class from the module. Example shows the default parameters except for host, username and password.

from asusrouter import AsusRouter

router = AsusRouter(host = "router.my.address",         #required - both IP and URL supported
                    username = "admin",                 #required
                    password = "password",              #required
                    port = None,                        #optional - default port would be selected based on use_ssl parameter
                    use_ssl = False,                    #optional
                    cert_check = True,                  #optional
                    cert_path = "",                     #optional
                    cache_time = 5,                     #optional
                    enable_monitor = True,              #optional
                    enable_control = False)             #optional

The module has the initialization method to load all the known data (all the monitors and methods from the next section, require enable_monitor to be True):

router.async_initialize()

Monitors and additional methods

Most of the values, obtained from the router are grouped in several monitor methods to decrease the amount of data sent between the library and the device. All of them require the enable_monitor parameter of AsusRouter to be set to True.

async_monitor_main()
async_monitor_nvram()
async_monitor_misc()
async_monitor_devices()

A detailed description of monitors and monitoring methods is available here (in work).

Commands

AsusRouter class supports sending commands to the device using the async_command method. Sending commands requires the enable_command parameter of AsusRrouter to be set to True.

For example, to reboot the device:

# This command will REBOOT your device if connected!
router.async_command(commands = {"rc_service": "reboot"}, action_mode = "apply")

Commands to the method should be sent as a dict of command: value. Please, refer to the Command List (in work) for a detailed explanation of the available commands.

Supported devices and firmware

Device model Support level
RT-AC66U Complete
Firmware version Build Extended Support level
3.0.0.4 382 52287-g798e87f Complete

Support the library

Issues and Pull requests

If you have found an issue working with the library or just want to ask for a new feature, please fill in a new issue.

You are also welcome to submit pull requests to the repository!

Check it with your device

Testing the library with different devices would help a lot in the development process. Unfortunately, currently, I have only one device available, so your help would be much appreciated.

Other support

This library is a free-time project. If you like it, you can support me by buying a coffee.

Buy Me A Coffee

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asusrouter-0.4.1.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asusrouter-0.4.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file asusrouter-0.4.1.tar.gz.

File metadata

  • Download URL: asusrouter-0.4.1.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for asusrouter-0.4.1.tar.gz
Algorithm Hash digest
SHA256 420510bde47d2c9da40ef24f6f6e87bc4735f119ac714f5ce341b6211779c8c4
MD5 2fb450b80f0baa72f960c2e03bb0c921
BLAKE2b-256 33f4cc340405913e69d0839a79b170deec28aefd154526fcb9b3cdc97de47372

See more details on using hashes here.

File details

Details for the file asusrouter-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: asusrouter-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for asusrouter-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea001439fe80831a4fb6c7ebdf3f7e7bcc7eeb96b504f896acca1f3c2ee66ce7
MD5 50d868b2c44174edb564c901beb77c24
BLAKE2b-256 c8c897db1fb2a358e4b0ca0fb1d0796b914f03d09c8afabdbe874fbbd97d256f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page