{"id":16358701,"url":"https://github.com/hertzg/node-tplink-api","last_synced_at":"2025-03-21T00:31:38.461Z","repository":{"id":60600751,"uuid":"544204480","full_name":"hertzg/node-tplink-api","owner":"hertzg","description":"TP-Link Router API (EU version) for NodeJs to control the router directly.","archived":false,"fork":false,"pushed_at":"2024-08-16T13:43:28.000Z","size":49,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T19:21:23.339Z","etag":null,"topics":["3g","archer","automation","ax3000","gdpr","gprs","lte","mr6400","router","sms","sms-gateway","tl-mr6400","tp-link","tp-link-archer","tp-link-sms","tplink","tplink-api","tplink-archer","tplink-sms","wifi6"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hertzg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-01T23:08:39.000Z","updated_at":"2025-02-20T15:57:25.000Z","dependencies_parsed_at":"2023-12-21T20:15:18.450Z","dependency_job_id":"ba908fa1-42c0-4725-86da-eb581b1714f3","html_url":"https://github.com/hertzg/node-tplink-api","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":"0.19999999999999996","last_synced_commit":"0969605bbe22793b2112cb0fcd3b392945811a70"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-tplink-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-tplink-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-tplink-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-tplink-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hertzg","download_url":"https://codeload.github.com/hertzg/node-tplink-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717384,"owners_count":20498283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3g","archer","automation","ax3000","gdpr","gprs","lte","mr6400","router","sms","sms-gateway","tl-mr6400","tp-link","tp-link-archer","tp-link-sms","tplink","tplink-api","tplink-archer","tplink-sms","wifi6"],"created_at":"2024-10-11T02:06:30.632Z","updated_at":"2025-03-21T00:31:38.074Z","avatar_url":"https://github.com/hertzg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TP-Link Router API (EU GDPR versions)\n\nTested on the following units should work on others as well\n* ✔️ `TL-MR6400`\n* ✔️ `Archer VR900v` (https://github.com/hertzg/node-tplink-api/pull/2)\n* ❔ `Archer MR600`  (https://github.com/hertzg/node-tplink-api/issues/5)\n* ✔️ `TL-MR6500v` (https://github.com/hertzg/node-tplink-api/discussions/7)\n\nIf this works on your device but is not listed here please create an issue or a pr updating the list\n\n## Example\n\n```shell\n$ npm i tl-api\n\n# or\n\n$ yarn add tl-api\n```\n\n```javascript\nimport { ACT, authenticate, execute } from \"tl-api\";\n\nconst baseUrl = \"http://192.168.1.1\";\n\nconst { info, ...context } = await authenticate(baseUrl, {\n  password: \"admin\",\n});\nconsole.log(\"info: %j\", info);\nconsole.log(\"sess: %j\", context.sessionId);\nconsole.log(\"tokn: %j\", context.tokenId);\n\nconst result = await execute(\n  baseUrl,\n  [\n    [\n      ACT.GL,\n      \"LAN_WLAN\",\n      [\n        \"name\",\n        \"Standard\",\n        \"SSID\",\n        \"BSSID\",\n        \"X_TP_Band\",\n        \"PossibleChannels\",\n        \"AutoChannelEnable\",\n        \"Channel\",\n        \"X_TP_Bandwidth\",\n        \"Enable\",\n        \"BasicEncryptionModes\",\n        \"BeaconType\",\n      ],\n    ],\n  ],\n  context\n);\nconsole.dir(result, { depth: 4 });\n```\n\n## Usage\n\nOnce authenticated you will need to use the `execute` function and pass it an array of actions.\n\n### Actions\n\nActions is an array of operations you want to perform. Each operation is defined as an array in the following format\n\nYou can login into your router and hook into data encrypt and decrypt methods with the following snippet.\n\n```javascript\n$.Iencryptor.AESDecrypt_backup = $.Iencryptor.AESDecrypt;\n$.Iencryptor.AESEncrypt_backup = $.Iencryptor.AESEncrypt;\n$.Iencryptor.AESDecrypt = function(data) {\n\tlet decrypted = $.Iencryptor.AESDecrypt_backup(data);\n\tconsole.log(\"RECV:\\n\" + decrypted);\n\treturn decrypted;\n}\n$.Iencryptor.AESEncrypt = function(data) {\n\tconsole.log(\"SEND:\\n\" + data);\n\treturn $.Iencryptor.AESEncrypt_backup(data);\n}\n```\n\nThis will log `RECV:` \u0026 `SEND:` message before encrypting and decrypting payload, and you can take a note of `\u003cactionType\u003e`, `\u003cactionOperationId\u003e`, `\u003cactionAttributesOrFields\u003e`, `\u003cstack\u003e`, `\u003cpStack\u003e` values after you perform specific actions in the UI.\n\nYou can see some values described in this document in the Example section and also in `example.js`.\n\n\n#### Format:\n\n```\n[\n  [\u003cactionType\u003e, \u003cactionOperationId\u003e, \u003cactionAttributesOrFields\u003e, \u003cstack\u003e, \u003cpStack\u003e],\n]\n```\n\n| Field                        | Required | Default         | Type                                | Description                                                                                                                                                                                                                                             | Example                                                        |\n| ---------------------------- | -------- | --------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |\n| `\u003cactionType\u003e`               | Yes      | -               | `number`                            | Action type, can be any of `ACT.*`                                                                                                                                                                                                                      | `ACT.GET`                                                      |\n| `\u003cactionOperationId\u003e`        | Yes      | -               | `string`                            | String representing the operation                                                                                                                                                                                                                       | `\"LTE_BANDINFO\"`                                               |\n| `\u003cactionAttributesOrFields\u003e` | No       | `[]`            | `string[]` or `Record\u003cstring, any\u003e` | Optional list or a key value map of attributes. Writes usually need a map and reads, specifically reading lists requires fields as array. Not all operations require attributes, for such cases you can skip or use an empty array `[]` or object `{}`. | `{pageNumber: 12}` or `['index', 'from', 'content', 'unread']` |\n| `\u003cstack\u003e`                    | No       | `\"0,0,0,0,0,0\"` | `string`                            | Not really sure what this does but some `\u003cactionOperationId\u003e`s require specific \"stacks\". If ommited the default all zeros are used.                                                                                                                    | `\"2,1,0,0,0,0\"`                                                |\n| `\u003cpStack\u003e`                   | No       | `\"0,0,0,0,0,0\"` | `string`                            | Not sure if this is used by the device at all, almost always this stays as default all zeros.                                                                                                                                                           | `\"0,0,0,0,0,0\"`                                                |\n\n#### Examples:\n\n```javascript\nconst getLteBandInfo = [[ACT.GET, \"LTE_BANDINFO\"]];\n\nconst getTotalUnreadSmsMessages = [\n  [ACT.GET, \"LTE_SMS_UNREADMSGBOX\", [\"totalNumber\"]],\n];\n\nconst getUnreadSmsMessageBoxPage = [\n  [ACT.SET, \"LTE_SMS_UNREADMSGBOX\", { pageNumber: 1 }],\n  [\n    ACT.GS,\n    \"LTE_SMS_UNREADMSGENTRY\",\n    [\"index\", \"from\", \"content\", \"receivedTime\", \"unread\"],\n  ],\n];\n\nconst performLogout = [[ACT.CGI, \"cgi/logout\"]];\n```\n\n#### Response\n\n```json5\n{\n  error: 0,\n  // error code or 0 if success\n  actions: [\n    // actions array is in the same order as the actions to be performed\n    {\n      req: [1, \"LTE_BANDINFO\"],\n      // original actions that got executed\n      res: {\n        // resulting object or an array if the request was ACT.GS or ACT.GL\n        stack: \"0,0,0,0,0,0\",\n        attributes: {\n          // Attributes related to this particular request\n          LTE_RadioInterface: \"8\",\n          LTE_ActiveBand: \"122\",\n          LTE_ActiveChannel: \"1699\",\n        },\n      },\n    },\n  ],\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhertzg%2Fnode-tplink-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhertzg%2Fnode-tplink-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhertzg%2Fnode-tplink-api/lists"}