execute(): Promise<ExecuteResult>
Executes one or more actions on the router.
Handles the full request/response cycle:
- Splits the actions into as many round trips as the dialect needs
- Encrypts and sends each request
- Decrypts and decodes each response
- Maps responses back onto the original requests by position
The returned actions array always has one entry per input action, in input
order; actions the router returned nothing for carry res: null. A transport
failure (any non-200 response) short-circuits to
{ error: -1, actions: [] }.
Get LTE band information
Get LTE band information
import { ACT, authenticate, execute } from "@hertzg/tplink-api"; const auth = await authenticate("http://192.168.1.1", { password: "admin" }); if (auth) { const result = await execute( "http://192.168.1.1", [[ACT.GET, "LTE_BANDINFO"]], auth, ); // result.actions[0].res contains the band info }
Execute multiple actions
Execute multiple actions
import { ACT, authenticate, execute } from "@hertzg/tplink-api"; const auth = await authenticate("http://192.168.1.1", { password: "admin" }); if (auth) { const result = await execute( "http://192.168.1.1", [ [ACT.SET, "LTE_SMS_UNREADMSGBOX", { pageNumber: "1" }], [ACT.GS, "LTE_SMS_UNREADMSGENTRY", ["index", "from", "content"]], ], auth, ); }
actions: Action[]
Array of actions to execute
options: ExecuteOptions
Execution options from authentication result
Promise<ExecuteResult>
Execution result with error status and action responses