1.0.33 • Published 3 months ago
node-asuswrt v1.0.33
node-asuswrt
API wrapper/client for Asus WRT routers/access points
All async methods return promise based types and can be awaited.
Example
import { AsusWRT } from "node-asuswrt";
const config = {
Username: 'admin',
Password: 'password',
BaseUrl: 'http://192.168.1.1',
ErrorLogCallback: (logDescription, logData) => { // optional property
if (logData) {
console.log(logDescription, logData);
} else {
console.log(logDescription);
}
},
InfoLogCallback: (logDescription, logData) => { // optional property
if (logData) {
console.log(logDescription, logData);
} else {
console.log(logDescription);
}
}
}
const asus = new AsusWRT.AsusWRT(config);
asus.getWANStatus().then(result => {
console.log(result);
});
asus.getTotalTrafficData().then(result => {
console.log('traffic', result);
})
asus.getRouters().then(result => {
result.forEach(router => {
asus.getCPUMemoryLoad(router.mac).then(result => {
console.log('load', result);
});
asus.getUptime(router.mac).then(result => {
console.log('uptime', result);
});
asus.setLedsEnabled(router.mac, true).then(success => {
console.log(success);
});
asus.getWirelessClients(router.mac, "2G").then(wiredClients => {
console.log(router.alias, wiredClients);
});
})
});
Methods
Import the wrapper
import { AsusWRT } from "node-asuswrt";
Create a new instance of the wrapper
const config = {
Username: 'admin',
Password: 'password',
BaseUrl: 'http://192.168.1.1',
ErrorLogCallback: (logDescription, logData) => { // optional
if (logData) {
console.log(logDescription, logData);
} else {
console.log(logDescription);
}
},
InfoLogCallback: (logDescription, logData) => { // optional
if (logData) {
console.log(logDescription, logData);
} else {
console.log(logDescription);
}
}
}
const asus = new AsusWRT.AsusWRT(config);
Get all routers in the network (async)
asus.getRouters()
Get wireless clients connected to router (async)
asus.getWirelessClients(router.mac, "2G") // 2.4ghz devices
asus.getWirelessClients(router.mac, "5G") // 5ghz devices
Get wired clients connected to router (async)
asus.getWiredClients(router.mac)
Set LED value for router (async)
asus.setLedsEnabled(router.mac, true) // turns leds on
asus.setLedsEnabled(router.mac, false) // turns leds off
Reboot network (all access points) (async)
asus.rebootNetwork()
Reboot router (async)
asus.rebootDevice(router.mac);
Get CPU and Memory Load (async)
asus.getCPUMemoryLoad(router.mac) // requires mac of router / access point
Get uptime in seconds (async)
asus.getUptime(router.mac) // requires mac of router / access point
Get total traffic data (async)
asus.getTotalTrafficData()
// poll this function to get realtime data usage for example 2 seconds interval and calculate difference
Get WAN Status (async)
asus.getWANStatus()
Get Wake On Lan Devices (async)
asus.getWakeOnLanList()
Run Wake On Lan command (async)
asus.wakeOnLan(wakeOnLanDeviceMac)
Objects
AsusWRTConnectedDevice
{
ip: string,
mac: string,
name: string,
nickName: string,
dpiDevice: string,
vendor: string,
ipMethod: string,
rssi: number
}
AsusWRTLoad
{
CPUUsagePercentage: number,
MemoryUsagePercentage: number
}
AsusWRTOperationMode
{
Router: 0,
AccessPoint: 1
}
AsusWRTRouter
{
alias: string,
modelName: string,
uiModelName: string,
productId: string,
firmwareVersion: string,
newFirmwareVersion: string,
ip: string,
mac: string,
online: boolean,
operationMode: AsusWRTOperationMode
}
AsusWRTTrafficData
{
trafficReceived: number;
trafficSent: number;
}
AsusWRTWANStatus
{
status?: number;
statusstr?: string;
type?: string;
ipaddr?: string;
netmask?: string;
gateway?: string;
dns?: string;
lease?: number;
expires?: number;
xtype?: string;
xipaddr?: string;
xnetmask?: string;
xgateway?: string;
xdns?: string;
xlease?: number;
xexpires?: number;
}
AsusWRTWakeOnLanDevice
{
name: string,
mac: string
}
1.0.33
3 months ago
1.0.29
7 months ago
1.0.32
7 months ago
1.0.30
7 months ago
1.0.28
9 months ago
1.0.27
12 months ago
1.0.26
1 year ago
1.0.25
1 year ago
1.0.24
1 year ago
1.0.23
1 year ago
1.0.22
1 year ago
1.0.21
1 year ago
1.0.20
1 year ago
1.0.19
1 year ago
1.0.18
1 year ago
1.0.17
1 year ago
1.0.16
1 year ago
1.0.15
1 year ago
1.0.14
1 year ago
1.0.13
1 year ago
1.0.12
1 year ago
1.0.11
1 year ago
1.0.10
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago