The core library for interacting with routers running Padavan firmware. Provides a programmatic API for local control via HTTP.
npm install padavan[[RU]](./docs/ru/README.md) | [EN]
A Node.js library for managing routers running Padavan firmware.
It interacts with the router via its Web Interface (HTTP), providing
programmatic access to configuration, diagnostics, and firmware management
functions.
Upgrading from v1? Check the Migration Guide for
details on breaking changes (move from SSH to HTTP, new constructor) and removed
features.
``bash`
npm install padavan
`javascript
import Padavan from 'padavan';
const client = new Padavan({
credentials: {
host: '192.168.1.1',
username: 'admin',
password: 'password'
},
logLevel: 'error'
});
// Get system status
const status = await client.getStatus();
console.log(Uptime: ${status.uptime});`
The constructor accepts a config object with the following properties:
| Property | Description |
| --- | --- |
| credentials | Object containing connection details. |logLevel
| | Logging level: 'none', 'error', 'info', 'debug'. |
| Property | Description |
| --- | --- |
| host | Router IP address or hostname. |username
| | Web interface username. |password
| | Web interface password. |repo
| | GitHub owner/repo for firmware updates. |branch
| | GitHub branch (e.g., main). |token
| | GitHub PAT for accessing Actions/Artifacts. |
- getStatus()
Returns CPU load, RAM usage, uptime, and basic Wi-Fi status.
- getLog()
Fetches the complete system log.
- exec(command)
Executes a system command via the web console emulator (SystemCmd).sendAction(action, payload?)
Returns: Command output (stdout + stderr).
- apply.cgi
Sends a low-level action to .action
Arguments: (string, e.g., ' Reboot '), payload (data object).startReboot()
Returns: Server response (command output or status).
-
Reboots the router via HTTP command.
- getDevices()
Returns a list of connected clients from the ARP table and Wi-Fi driver.
Properties: mac, ip, hostname, type (eth, wifi, 2.4GHz, 5GHz),rssi
.getHistory()
- { daily: [...], monthly: [...] }
Returns traffic statistics.
Structure: .
- startScan(band)
Performs a Site Survey (scan).
Band: '2.4' or '5'.getBestChannel(band)
-
Wi-Fi Doctor: Scans the environment, calculates interference scores, and
recommends the optimal channel for your router.
- getParams(keys?, page?)
Returns NVRAM variables.
Arguments:
- keys: Specific key string or array of keys. If omitted, returns all.page
- : If provided, parses input fields from a specific ASP page HTML insteadnvram show
of using .setParams(params, options?)
- action_mode
Sets NVRAM variables.
Options: (e.g., ' Apply '), sid_list (Service IDs togroup_id
restart), , current_page.
Requires GitHub credentials (repo, branch, token).
- findFirmware(model?)
Searches for firmware artifacts in the configured repository network (looks
into forks).
- getChangelog()
Compares the current router version with the latest artifact and returns a list
of commits.
- startBuild()
Triggers a GitHub Actions workflow to build new firmware.
- startUpgrade()`
Downloads the latest artifact, uploads it to the router, and flashes it.
This package includes a CLI tool. See CLI Documentation.