Skip to main content

API wrapper for communication with ASUSWRT-powered routers

Project description

GitHub Release License
Downloads Commit activityBuy Me A Coffee

AsusRouter

AsusRouter is an API wrapper for communication with ASUSWRT-powered routers using HTTP(S) protocols. The library supports both the stock AsusWRT firmware and AsusWRT-Merlin.

Up till now, it is only used for the custom AsusRouter Home Assistant integrartion. But I am always open to making it suitable for any other use.

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

AsusRouter supports virtually every AsusWRT-powered device.

All the devices which were tested (also by the integration users) are explicitly marked as so, as well as the firmware type(s) / version(s).

Tested

802.11ax

Model Stock Merlin / GNUton Find it on Amazon[^amazon]
DSL-AX82U 386.07_0-gnuton0_beta2 link
GT-AX11000 386.7_2 link
RT-AX55 link
RT-AX56U 386.7_2 link
RT-AX58U 386_49674 386.7_2 link
RT-AX68U link
RT-AX82U 386_48664, 386.49674 link
RT-AX86S 386_49447 link
RT-AX86U 386_46061, 386_48260 386.7_2 link
RT-AX88U (testing device) 386_45934, 386_48631 386.5_2 link
RT-AX89X link
RT-AX92U 386_46061 link
TUF-AX5400 link
ZenWiFi AX (XT8) 386_48706 386.07_2-gnuton1 link
ZenWiFi AX Mini (XD4) 386_48790, 386_49599 link

802.11ac

Model Stock Merlin / GNUton Find it on Amazon[^amazon]
4G-AC55U link
DSL-AC68U 386_47534 386.04-gnuton2 link
RT-AC51U 380_8591 link
RT-AC52U B1 link
RT-AC5300 386.7_2 link
RT-AC57U V3 386_21649 link
RT-AC58U / RT-ACRH13 link
RT-AC66R / RT-AC66U 380.70_0 link
RT-AC66U B1 link
RT-AC68U 386.5_2, 386.7_0 link
RT-AC86U 386_48260 386.7_0, 386.7_2 link
RT-AC87U 384.13_10 link
RT-AC88U 386.7_beta1 link
RT-ACRH17 382.52517 link

802.11n

Model Stock Merlin / GNUton Find it on Amazon[^amazon]
RT-N66U link

Else

Usage of AsusWRT-Merlin on non-Asus devices is ILLEGAL As stated by developers of Merlin (link)

Model Merlin / GNUton
Netgear R6300V2 380.70
Netgear R7000 386.2_4, 380.70_0-X7.9

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

[^amazon]: As an Amazon Associate I earn from qualifying purchases. Not like I ever got anything yet (:

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.15.2.tar.gz (37.6 kB view hashes)

Uploaded Source

Built Distribution

asusrouter-0.15.2-py3-none-any.whl (38.1 kB view hashes)

Uploaded Python 3

Supported by

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