Skip to main content

API wrapper for communication with ASUSWRT-powered routers

Project description

AsusRouter

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

Supported features

  • Monitoring data when enable_monitor parameter of AsusRrouter is set to True (default)
  • 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)s

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.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

AsusRouter class has 3 monitors to load a large part of useful data from the device. All of them require the enable_monitor parameter of AsusRrouter to be set to True. The following methods can be used:

router.async_monitor_main()

router.async_monitor_nvram()

router.async_monitor_misc()

Moreover, some additional methods are also available (that could partially rely on one of the monitors):

router.async_find_interfaces()

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

Currently, AsusRouter is tested on my only router model. If you wish to help me make it better, feel free to open a Pull Request with your model name and firmware (if everything works well). Chances are much higher that some problems may occur on other devices, so Issues are waiting for a new one.

Devices

Model Support level
RT-AC66U Complete

Firmware

Version Build Extended Support level
3.0.0.4 382 52287-g798e87f Complete

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.2.6a0.tar.gz (17.6 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.2.6a0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file asusrouter-0.2.6a0.tar.gz.

File metadata

  • Download URL: asusrouter-0.2.6a0.tar.gz
  • Upload date:
  • Size: 17.6 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.2.6a0.tar.gz
Algorithm Hash digest
SHA256 94ac61bfa56d1a3738dab88dcf5ce8973d79f2ed398b24e5f342c933e7c6f2a1
MD5 db67b21e4cfee8af63d34eeba9de54e3
BLAKE2b-256 c2f52963866704c6f8c02ed8b7ca0a4ee66e490cc0caa48b3c36fa1089830e16

See more details on using hashes here.

File details

Details for the file asusrouter-0.2.6a0-py3-none-any.whl.

File metadata

  • Download URL: asusrouter-0.2.6a0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 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.2.6a0-py3-none-any.whl
Algorithm Hash digest
SHA256 3930145284ee12edbcc8d63f94a0ebc18e8629643d98dae785bab137eebc9f0b
MD5 1a3858be10328316fbd8a800c218fcbb
BLAKE2b-256 36551a09870eabf3fcc973ceac72d87a388784cb03c05c5ef3c9527a9903b16f

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